内部类访问外部类的变量必须是final吗? 如下: package com.java.concurrent; class A { int i = 3; public void shout() { class B { public void shout1() { System.out.println(i); } } B b = new B(); b.shout1(); } public static void main(String[] args) { A a = new A(); a.shout…
内部类 // 外部类 class Demo{ private int num = 3; // 定义内部类 class Int{ void show(){ System.out.println("num="+num); } } void method(){ Int int = new Int(); int.show(); } } class Inner{ public static void main(Stirng[] args){ Demo demo = new Demo(); dem…