50,530
社区成员
发帖
与我相关
我的任务
分享
public class TestA {
int n=0;
int m=0;
}
public class TestB extends TestA {
int n=0;
}
public class E {
TestA testA;
public void Out(TestA testA){
System.out.println("n:"+testA.n);
System.out.println("m:"+testA.m);
}
}
public class TestE extends E {
public static void main(String[] args) {
TestE e= new TestE();
TestB testB =new TestB();
testB.m =128;
testB.n =128;
e.Out(testB);
}
}
输出结果
n:0
m:128
为什么m的值为128而不是0?
原帖:http://bbs.csdn.net/topics/391892994?page=1#post-401564567