2段階目完了

This commit is contained in:
m-endo
2026-09-14 16:13:11 +09:00
parent 29c3693c68
commit 55f693acce
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
public class BasicCheck2 {
public static void main(String[] args) {
//変数宣言
Student student = new Student();
//代入
student.studentId = 1;
student.name = "鈴木一郎";
student.printProfile();
}
}

13
em-oop/src/Student.java Normal file
View File

@@ -0,0 +1,13 @@
public class Student {
//フィールド宣言
int studentId;
String name;
//メソッド宣言
void printProfile() {
System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name);
}
}