Files
java-question/Question12-Encapsulation/src/PTra12_01.java
2026-09-09 08:34:32 +09:00

27 lines
885 B
Java
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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);
}
}