8段階目(セッターに簡単なチェックを入れてみよう)

This commit is contained in:
s-sakiyama
2026-09-15 14:24:20 +09:00
parent 3b6b23c883
commit 968c5094a4
2 changed files with 14 additions and 1 deletions

View File

@@ -55,6 +55,16 @@ public class Main {
}
System.out.println("現在の社員のデータ件数:" + EmployeeData.getEmpCount() + "件");
System.out.println();
//nullおよび前後の空白を取り除いた結果が空文字チェック
EmployeeData emp = new EmployeeData("10000", "デフォルト", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
System.out.println(emp);
emp.setNmEmployee(null);
System.out.println(emp);
emp.setNmEmployee("   ");
System.out.println(emp);
}
}