Java中构造方法的赋值最好用set方法

Java中构造方法的赋值最好用set 方法

这样可以在set方法中添加业务逻辑

1
2
3
4
5
6
public Student(String studentNo, String studentName, String studentSex, int studentAge) {
this.setStudentNo(studentNo);
this.setStudentName(studentName);
this.setStudentSex(studentSex);
this.setStudentAge(studentAge);
}

-------------End Of This ArticleThank You For Reading-------------