From 55f693acce042bc2673052ebb4f5821716c6c2c5 Mon Sep 17 00:00:00 2001 From: m-endo <26-s-i-tm-nets@it-college.jp> Date: Mon, 14 Sep 2026 16:13:11 +0900 Subject: [PATCH] =?UTF-8?q?2=E6=AE=B5=E9=9A=8E=E7=9B=AE=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- em-oop/src/BasicCheck2.java | 12 ++++++++++++ em-oop/src/Student.java | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 em-oop/src/BasicCheck2.java create mode 100644 em-oop/src/Student.java diff --git a/em-oop/src/BasicCheck2.java b/em-oop/src/BasicCheck2.java new file mode 100644 index 0000000..d85b755 --- /dev/null +++ b/em-oop/src/BasicCheck2.java @@ -0,0 +1,12 @@ + +public class BasicCheck2 { + public static void main(String[] args) { + //変数宣言 + Student student = new Student(); + //代入 + student.studentId = 1; + student.name = "鈴木一郎"; + student.printProfile(); + + } +} diff --git a/em-oop/src/Student.java b/em-oop/src/Student.java new file mode 100644 index 0000000..0876ea7 --- /dev/null +++ b/em-oop/src/Student.java @@ -0,0 +1,13 @@ + +public class Student { + //フィールド宣言 + int studentId; + String name; + + //メソッド宣言 + void printProfile() { + System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name); + + } +} +