10/15作業分

This commit is contained in:
2026-10-15 16:30:26 +09:00
parent 4b2cb5a18b
commit 82628fc7f5
9 changed files with 394 additions and 145 deletions

View File

@@ -1,10 +1,31 @@
package misson1014;
public class Student {
int studentId;
String name;
int studentId;
String name;
//staticフィールド
static int studentCount = 0;
//コンストラクタ
public Student(int studentId, String name) {
//フィールド代入
this.studentId = studentId;
this.name = name;
studentCount++;
}
//学生情報
void printProfile() {
System.out.println(
"学籍番号:" + this.studentId
+ " 名前:" + this.name);
}
//現在の学生数用staticメソッド
public static int getStudentCount() {
return studentCount;
}
void printProfile() {
System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name);
}
}