Java子类属性继承父类属性

public abstract class Parent {
    
    String name = "parent";

}    



public class Son extends Parent{
    
    public void print(){
        this.name = "son";
        System.out.println(super.name);
        System.out.println(this.name);
    }
    
    public static void main(String[] args) throws InstantiationException, IllegalAccessException {
        Son son = new Son();
        son.print();
    }
    
}


son
son

可以看出,子类中的属性的引用指向的是父类属性的地址。