public void method() {
//int a = 1;
// blog1.Outer.method().Inner
final int b = 2;
System.out.println("OuterMethod");
class Inner {
@Override
public String toString() {
// 沒被final修飾,不能夠內部類訪問。
// System.out.println(a);
System.out.println("Inner" + b);
return b + "";
}
}
obj = new Inner();
}
}
public class Proj01 {
public static void main(String[] args) throws Exception {
Outer outer = new Outer();
outer.method();
outer.obj.toString();