4日目
This commit is contained in:
23
CUI_EM_OOP/src/Student.java
Normal file
23
CUI_EM_OOP/src/Student.java
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
public class Student {
|
||||
int studentId;
|
||||
String name;
|
||||
|
||||
public void printProfile() {
|
||||
System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name);
|
||||
}
|
||||
|
||||
public Student(int studentId, String name) {
|
||||
this.studentId = studentId;
|
||||
this.name = name;
|
||||
|
||||
studentCount++;
|
||||
|
||||
}
|
||||
static int studentCount = 0;
|
||||
|
||||
public static int getStudentCount() {
|
||||
return studentCount;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user