1日目
This commit is contained in:
24
ObjectSample_20261014_hirayama.java
Normal file
24
ObjectSample_20261014_hirayama.java
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
public class ObjectSample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
//原本のコピー(インスタンス生成)
|
||||
Student student1 = new Student();
|
||||
Student student2 = new Student();
|
||||
|
||||
//name、ageへの代入
|
||||
student1.name = "田中";
|
||||
student1.age = 30;
|
||||
|
||||
student2.name = "山本";
|
||||
student2.age = 25;
|
||||
|
||||
//introduceメソッドの呼び出し
|
||||
student1.intoroduce();
|
||||
|
||||
student2.intoroduce();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user