abstract class Animal{
public abstract void eat();
public void run(){
System.out.println("run");
}
}
class Demo {
public static void main(String[] args) {
Animal animal = new Animal(){
public void eat(){
System.out.println("eat");
}
};
animal.eat();
}
}
|
|