Files
java-cui-em-oop/em-oop/src/Student.java

21 lines
378 B
Java

public class Student {
int studentId;
String name;
static int studentCount = 0;
void printProfile() {
System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name);
}
public Student(int studentId, String name) {
this.studentId = studentId;
this.name = name;
studentCount++;
}
public static int getStudentCount() {
return studentCount;
}
}