2日目_段階3完了

This commit is contained in:
2026-09-18 10:56:38 +09:00
parent 9780db9a8f
commit 2c6742fd26
2 changed files with 22 additions and 25 deletions

View File

@@ -2,29 +2,30 @@
public class BasicCheck2 {
public static void main(String[] args) {
Student student = new Student();
// Student student = new Student(3,"a");
//Student型のstudentを宣言、インスタンスを代入する
Student student1 = new Student();
Student student2 = new Student();
Student student3 = new Student();
Student student1 = new Student(1,"鈴木一郎");
Student student2 = new Student(2, "田中花子");
Student student3 = new Student(3,"佐藤次郎");
student1.studentId = 1;
student1.name = "鈴木一郎";
//studentIDに1,nameに鈴木一郎を代入
student2.studentId = 2;
student2.name ="田中花子";
student3.studentId = 3;
student3.name ="佐藤次郎";
// student1.studentId = 1;
// student1.name = "鈴木一郎";
// //studentIDに1,nameに鈴木一郎を代入
//
// student2.studentId = 2;
// student2.name ="田中花子";
//
// student3.studentId = 3;
// student3.name ="佐藤次郎";
//
//studentのprintProfileメソッドを呼び出す
student.printProfile();
student1.printProfile();
student2.printProfile();
student3.printProfile();
}
}