DESKTOP-QUF3J7K_20200907-柴宁宁

问题:
public class Penson {

    private String name = "Penson";
    int age = 100;
    
}
public class Child extends Penson{
    
    public String grade;
    
    public static void main(String[] args) {
        
        Penson p = new Child();
        System.out.println( p.name);//出错
    }

}

private修饰符修饰的字段不能被调用

吐槽

昨天睡得迟了,舍友的呼噜让人久久的睡不着,

标签

© 2021 成都云创动力科技有限公司 蜀ICP备20006351号-1