- interface Inter
- {
- void method();
- }
- class Test
- {
- static Inter function()
- {
- return new Inter()
- {
- public void method()
- {
- System.out.println("Hello Java");
- }
- };
- }
- }
- class InnerClassTest
- {
- public static void main(String[] args)
- {
- Inter in = Test.function();//这句话怎么理解?
- in.method();
- }
- }
复制代码 |
|