段階2

This commit is contained in:
m-shimizu
2026-09-15 13:51:34 +09:00
parent 7559a7dfa7
commit 357ad900a1
2 changed files with 8 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ public class BasicCheck2 {
// System.out.print("学籍番号"+student.studentId); // System.out.print("学籍番号"+student.studentId);
// System.out.print("名前:" + student.name); // System.out.print("名前:" + student.name);
student.printProfile(); student.printProfile();
} }
} }

View File

@@ -2,20 +2,21 @@
public class Student { public class Student {
int studentId; int studentId;
String name; String name;
public Student(int studentId, String name) { public Student(int studentId, String name) {
this.studentId = studentId; this.studentId = studentId;
this.name = name; this.name = name;
} }
public void printProfile() { public void printProfile() {
System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name); System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name);
} }
public static void main(String[] args) { //public static void main(String[] args) {
Student s = new Student(1,"鈴木一郎"); //Student s = new Student(1,"鈴木一郎");
s.printProfile(); //s.printProfile();
} //}
} }