java 父类中this.成员变量 怎么输出父类成员变量,this不是指向当前对象B,不是应该是输出2
public class A {
public int m = 1;
public void view() {
System.out.println(this.m);
}
}
class B extends A {
public int m = 2;
public static void main(String[] args) {
B b = new B();
System.out.println(b);
b.view();
}
}输出
test.B@6ca6fed5
1
...全文


Java SE
