?? testpeople.java
字號:
class People {
long Num;
String Name;
String Sex;
int Ages;
public People(long Num,String Name) {
this.Num=Num;
this.Name=Name;
}
public People(long Num,String Name,String Sex,int Ages) {
this(Num,Name);
this.Sex=Sex;
this.Ages=Ages;
}
public String ShowPeople() {
return(" 編號:"+Num+" 姓名:"+Name+" 性別:"+Sex+" 年齡:"+Ages);
}
public String ShowPeople(long Num1,String Name1) {
Num=Num1;
Name=Name1;
return(" 編號:"+Num+" 姓名:"+Name);
}
}
class Student extends People
{
String ClassNo;
public Student(long Num,String Name,String Sex,int Ages,String ClassNo) {
super(Num,Name,Sex,Ages);
this.ClassNo=ClassNo;
}
public String ShowStudent() {
return(ShowPeople()+" 班號:"+ClassNo);
}
}
class Teacher extends People {
String Principalship;
String Department;
public Teacher(long Num,String Name,String Principalship,String Department) {
super(Num,Name);
this.Principalship=Principalship;
this.Department=Department;
}
public String ShowTeacher() {
return(ShowPeople(Num,Name)+" 職務:"+Principalship+" 部門:"+Department);
}
}
public class TestPeople {
public static void main(String[] args) {
Student NewStudent=new Student(10010,"宋菘","男",22,"計算001");
System.out.println(NewStudent.ShowStudent());
Teacher NewTeacher=new Teacher(50030,"李黎","教師","信息系");
System.out.println(NewTeacher.ShowTeacher());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -