段階2完了いたしました。
This commit is contained in:
@@ -14,6 +14,7 @@ public class BasicCheck1 {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
14
em-oop/src/BasicCheck2.java
Normal file
14
em-oop/src/BasicCheck2.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
public class BasicCheck2 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Student student = new Student(1,"鈴木一郎");
|
||||||
|
|
||||||
|
student.studentId = 1;
|
||||||
|
student.name = "鈴木一郎";
|
||||||
|
|
||||||
|
// System.out.print("学籍番号"+student.studentId);
|
||||||
|
// System.out.print("名前:" + student.name);
|
||||||
|
student.printProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
22
em-oop/src/Student.java
Normal file
22
em-oop/src/Student.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
public class Student {
|
||||||
|
int studentId;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
public Student(int studentId, String name) {
|
||||||
|
this.studentId = studentId;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printProfile() {
|
||||||
|
System.out.println("学籍番号:" + this.studentId + " 名前:" + this.name);
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Student s = new Student(1,"鈴木一郎");
|
||||||
|
s.printProfile();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user