匿名类(anonymous clss)对象的创建解决思路

   阅读
匿名类(anonymous clss)对象的创建
匿名类(anonymous   clss):定义一个实现该接口的类,并且假设基于该类的对象仅有一个被创建,则可使用下列形式。
Inter   ob=new   Inter(){*};
我们把“{*}”称为匿名类。
但下面的例子不是创建了基于该类的两个对象ob1,ob2吗?这怎么解释呢?
interface   Inter{
public   void   hi();
}
public   class   Anony1{
public   static   void   main(String[]   args){
Inter   ob1=new   Inter(){
System.out.println( "你好 ");
}
};
Inter   ob2=new   Inter(){
public   void   hi(){
System.out.println( "hello ");
}
};
ob1.hi();
ob2.hi();
}
}


------解决方案--------------------
上面代码有2个匿名类,各有一个实例
阅读