代碼運(yùn)行出來只輸出b 沒有輸出a
?? private int a=99;
?? public class Inner
?? {
??? int b=4;
??? public void test()
??? {
???? System.out.println("訪問外部類"+a);
???? System.out.println("訪問內(nèi)部類"+b);
??? }
?? }
?? public static void main(String[] args)
?? {
??? Outer o=new Outer();
??? Inner i=o.new Inner();
??? i.test();
?? }
??
}
2015-04-19
在運(yùn)行一遍,是可以的。
2015-03-29
2015-03-29
應(yīng)該是? System.out.println("訪問外部類"+a);這行錯(cuò)了,應(yīng)該為? System.out.println("訪問外部類"+Outerthis.a);