this與super的使用
阿新 • • 發佈:2021-02-17
this與super
public class Person {
public String id="身份證號";
}
public class Student extends Person {
public String id="學號";
public void show(){
System.out.println(this.id);
System.out.println(super.id);
}
}
public class Test {
public static void main(String[] args) {
Student student=new Student();
student.show();
}
}