标签:ace int space 通过 public keyword 方法 abs x11
抽象类或接口 通过匿名内部类 进行实现,
abstract class Person { public abstract void eat();}public class Demo { public static void main(String[] args) { Person p = new Person() { public void eat() { System.out.println("eat something"); } }; p.eat(); }}interface Person { public void eat();}public class Demo { public static void main(String[] args) { Person p = new Person() { public void eat() { System.out.println("eat something"); } }; p.eat(); }}标签:ace int space 通过 public keyword 方法 abs x11
原文地址:http://www.cnblogs.com/tcdxx/p/6181471.html