本帖最后由 沐沐远去 于 2014-11-3 21:10 编辑
- class DiaoSi implements Person
- {
- String name;
- DiaoSi(String name){
- this.name=name;
- }
- public Money earn(){
- return Money(2000);
- }
- }
- class Itheima implements Super,Fast,Counterattack,Change{
- public enum ItheimaLocal extends Itheima
- {
- BEIJING,SHENZHEN;
- @Override .....
- }
-
- private Set<Person> classRoom= new HashSet<Person>();
- private Itheima(){}
- public static Itheima getItheima(){
- return ItheimaLocal.BEIJING;
- }
- public boolean synchronized choose(Person person){
- for(int time=3;time>0;time--)
- if(time==0)
- return false;
- person.isGreat()?classRoom.add(person);Itheima.study();return true:continue;
-
- }
- }
- public static void study(){
- for(int day=122;day>0;day--){
- for(Person person:classRoom){
- person=person.group();
- }
- }
- }
- }
- class Society
- {
- public static void main(String[] args)
- {
- DiaoSi jiaoXX = new DiaoSi("jiaoXX");
- if(Ithima.getIthima().choose(jiaoXX)){
- System.out.println("进入黑马");
- Money = jiaoXX.earn();
- }
-
- System.out.println(Money.toString());
- }
- }
复制代码
运行结果两种可能:
第一种:2000/月;
第二种:进入黑马 10000/月
|