[求助]java内部类问题
public class A{
private int a1;
public int a2;
static int a3;
public A(int a1,int a2){this.a1=a1;this.a2=a2;}
protected int methodA(){return a1*a2;}
class B{
int b1=a1;
int b2=a2;
int b3=a3;
int b4=new A(3,4).a1;
int b5=methodA();
}
public static void main(String args[]){
A.B b=new A(1,2).new B();
System.out.println("b.b1="+b.b1);
System.out.println("b.b2="+b.b2);
System.out.println("b.b3="+b.b3);
System.out.println("b.b4="+b.b4);
System.out.println("b.b5="+b.b5);
}
}
为什么b4输出的结果是3,而不是1呢?
让人不解,大家帮帮忙,先谢谢了!