This commit is contained in:
m-mun
2026-09-09 08:34:32 +09:00
parent 8e67b4ccb9
commit 1b863df929
181 changed files with 34869 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
/*
* ItemA.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
public class ItemA {
private String name = "アイテムA";
}

View File

@@ -0,0 +1,26 @@
/*
* PTra12_01.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
import common.User;
public class PTra12_01 {
public static void main(String[] args) {
// ※ この問題はcommonパッケージのUserクラスを完成させてから解いてください。
/*
* TODO インスタンスフィールドへのアクセスをアクセサ経由に変更してください
*/
User user = new User();
user.userId = 1000;
user.userName = "リゾーム太郎";
user.mailAddress ="rhizome@hogehoge.com";
user.password = "12345";
System.out.println("ID :" + user.userId);
System.out.println("名前 :" + user.userName);
System.out.println("メールアドレス  :" + user.mailAddress);
System.out.println("パスワード  :" + user.password);
}
}

View File

@@ -0,0 +1,16 @@
/*
* PTra12_02.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
// TODO 同一パッケージのItemAクラスを変更してエラーが出ないようにしてください。
// ※ このクラスの内容は変更しないこと
public class PTra12_02 {
public static void main(String[] args) {
ItemA item = new ItemA();
System.out.println(item.name);
}
}

View File

@@ -0,0 +1,18 @@
import common.ItemB;
/*
* PTra12_03.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
//TODO commonパッケージのItemBクラスを変更してエラーが出ないようにしてください。
//※ このクラスの内容は変更しないこと
public class PTra12_03 {
public static void main(String[] args) {
ItemB item2 = new ItemB();
System.out.println(item2.name);
}
}

View File

@@ -0,0 +1,11 @@
package common;
/*
* ItemB.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
public class ItemB {
String name = "アイテムB";
}

View File

@@ -0,0 +1,18 @@
package common;
/*
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
public class User {
// TODO 各フィールドにprivateアクセス修飾子を指定してください
int userId;
String userName;
String mailAddress;
String password;
// TODO 各フィールドのアクセサを作成してください
}