- interface Inter
- {
- public void method();
- }
- class Test
- {
- static Inter function()
- {
- return new Inter()
- {
- public void method()
- {
- System.out.println("oK");
- }
-
- };
- }
-
- }
- class Test2
- {
- static class Inner implements Inter
- {
- public void method()
- {
- System.out.println("ok !!!");
- }
- }
- static Inter function()
- {
- return new Inner();
- }
- }
- class neibulei
- {
- public static void main(String[] a){
- Test2.function().method();
-
-
- }
- }
复制代码
Test2.function().method(); 这句话我咋看不懂呢,,,,,,,,,,,,,,,,,,,请大神解释解释{:3_62:}
还有为什么匿名内部类要么实现接口,要么继承呢,,,,,,,,,,,,,,,,,,也请大神解释解释{:3_62:}
谢谢------:handshake:( |