java中子类调用父类构造方法,注意事项

  继承有个特点,就是子类无法访问父类的private字段或者private方法。例如,Student类就无法访问Person类的name和age字段: class Person {     private String name;     private int age; } class Student extends Person {     public String hello() {  
相关文章
相关标签/搜索