// 一个简单的学生类
public class Student {
private int sno; // 学号
private String sname; // 姓名
private int sage; // 年龄
private String profession; // 专业
public Student() {
}
public Student(int sno, String sname, int sage, String profession) {
super();
this.sno = sno;
this.sname = sname;
this.sage = sage;
this.profession = profession;
}
public int getSno() {
return sno;
}
public void setSno(int sno) {
this.sno = sno;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public int getSage() {
return sage;
}
public void setSage(int sage) {
this.sage = sage;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
@Override
public String toString() {
return "Student [sno=" + sno + ", sname=" + sname + ", sage=" + sage
+ ", profession=" + profession + "]";
}
}
public class Student{
private int stu_no;
private String name;
private int age;
private String profession;
设置下get/set方法
话说你连定义个类都不会 要来有啥用呢
}