回覆列表
-
1 # 使用者1560937188850899
-
2 # 電競圈醒夢
class Student{
private String name;
private Integer id;
private Integer xuefi;
private Integer credit;
}
class Student{
private String name;
private Integer id;
private Integer xuefi;
private Integer credit;
}
public class Student { //定義一個學生類 private int StuNum; //學號 private int Name; //姓名 private char Sex; //性別 private int Age; //年齡 public Student(int StuNum, int Name, char Sex, int Age){//建構函式 this.StuNum = StuNum; this.Name = Name; this.Sex = Sex; this.Age = Age; } public int getStuNum() { //獲得學號 return StuNum; } public int getName() { //獲得姓名 return Name; } public char getSex() { //獲得性別 return Sex; } public int getAge() { //獲得年齡 return Age; } public void setAge(int Age) { //修改年齡 this.Age = Age; } }