JAVA---抽象类的匿名子类
package exer;
public class Exer {
public static void main(String[] args) {
Person p=new Person(){
public void show(){
System.out.println("这是匿名类非匿名对象");
}
};
method(p);
System.out.println("************************");
method(new Person(){
public void show(){
System.out.println("这是匿名类匿名对象");
}
});
}
public static void method(Person p){
p.show();
}
}
abstract class Person{
String name;
public Person(){
}
public abstract void show();
}