, Java , . 196:
, , , , 2 , : ("studentName") , 2 ("studentName", " studentId"), , , 3 ("studentName", "studentId", " studentPhoneNumber").
. :
public class student {
private String studentName;
private int studentID;
private int studentPhoneNumber;
public student (String studentNameIn) {
studentName = studentNameIn;
}
public student (String studentNameIn, int studentIdIn) {
studentName = studentNameIn;
studentID = studentIdIn;
}
public student (String studentNameIn, int studentIdIn, int studentPhoneNumberIn) {
studentName = studentNameIn;
studentID = studentIdIn;
studentPhoneNumber = studentPhoneNumberIn;
}
public student () {}
}
. OBJECT, -, , / , 0 ( REINSERTED) 1 , / , 2 .. .
A superclass or several classes are not required, as the constructor may be overloaded, as shown above.
source
share