匿名- interface A
- {
- // final int n = 3;
- void method();
- }
- class Test
- {
- public static void main(String[] args)
- {
- new A()
- {
- public void method()
- {
- System.out.println("method run");
- }
- };//这个是一个类的对象还是一个接口的对象?按理接口没对象啊,中间有什么转换吗?
- }
- }
- //为什么 new A(){***}; 是建立一个对象?A不是接口interface吗,怎么能建立对象呢?
复制代码 |
|