1111ssss
public?class?Student?{
private?String?id;
private?String?name;
private?String?profession;
private?String?major;
public?Student(){
}
public?Student(String?id,String?name,String?major){
this.id?=?id;
this.name?=?name;
this.major?=?major;
}
public?static?void?main(String[]?args)?{
Student?s?=?new?Student("22222","张三","数学");
System.out.println(s.getId());
s.setName("张三");
System.out.println(s.getMajor());
s.setMajor("英语");
}
//获取学号
public?String?getId()?{
return?id;
}
//修改名字
public?void?setName(String?name)?{
this.name?=?name;
}
//获取所修课程
public?String?getMajor()?{
return?major;
}
//修改所修课程
public?void?setMajor(String?major)?{
this.major?=?major;
}
}