publicclassPerson{protectedint id =001;protected String name ="吴";protectedint age;......}publicclassStudentextendsPerson{privateint id =002;private String schoolName;publicvoidshow(){
System.out.println(this.id);
System.out.println(super.id);
System.out.println(super.name);}......}
super可用于访问父类中定义的方法
当子类重写父类的方法以后,可以使用“super.方法()”来调用父类的同名方法
publicclassPerson{protectedint id =001;protected String name ="吴";protectedint age;publicvoidshow(){......}......}publicclassStudentextendsPerson{privateint id =002;private String schoolName;publicvoidshow(){super.show();......}......}
在java类中使用super来调用父类中的指定操作super可用于访问父类中定义的属性当子类与父类中出现同名的属性时,可以通过“super.属性”来调用父类的属性,若想调用子类的同名属性,使用“this.属性”即可public class Person { protected int id = 001; protected String name = "吴"; prot...