编写一个学生类,属性:学号(整数类型),姓名,属性均为私有的.
(1) 编写无参构造方法和带参数的构造方法;
(2) 姓名属性的set,get方法。
(3) 学号属性的set get方法。
public class Student {
private int no;
private String name;
public Student(){
}
public Student(int no, String name) {
super();
this.no = no;
this.name = name;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}