?? testpeople_2.java
字號:
class People {
String Name;
String Num="01";
String Sex;
int Ages;
public String ShowInfo() {
return("姓名:"+Name+" 性別:"+Sex+" 年齡:"+Ages);
}
}
class Student extends People {
String Num;
String ClassNo;
public String ShowInfo() {
return("學號:"+Num+super.Num+" "+super.ShowInfo()+" 班號:"+ClassNo);
}
}
class Teacher extends People {
String Principalship;
String Department;
public String ShowInfo() {
return(super.ShowInfo()+" 職務:"+Principalship+" 部門:"+Department);
}
}
public class TestPeople_2 {
public static void main(String[] args) {
Student NewPeople=new Student();
NewPeople.Name="宋菘";
NewPeople.Num="1001";
NewPeople.Sex="男";
NewPeople.Ages=36;
NewPeople.ClassNo="計算001";
System.out.println(NewPeople.ShowInfo());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -