public class Outer { public void inner(){ final int num = 5; class InnerClass{ private int num = 4; public void testNum(){ System.out.println(this.num); } } } }
问题来了,如何在内部类的testNum方法中调用到外部方法中的num变量?
public class Outer { public void inner(){ final int num = 5; class InnerClass{ private int num = 4; public void testNum(){ System.out.println(this.num); } } } }
问题来了,如何在内部类的testNum方法中调用到外部方法中的num变量?