Compare commits
2 Commits
db8e199c9d
...
0ac701ce98
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ac701ce98 | ||
|
|
08b99dc55b |
@@ -99,19 +99,39 @@ public class Main {
|
||||
dept[5].setNmDepartment("営業企画部");
|
||||
allData[10] = dept[5];
|
||||
|
||||
int employeeCount = 0;
|
||||
int deptCount = 0;
|
||||
for (BaseData data : allData) {
|
||||
System.out.println(data);
|
||||
if (data instanceof EmployeeData) {
|
||||
employeeCount++;
|
||||
} else if (data instanceof DepartmentData) {
|
||||
deptCount++;
|
||||
}
|
||||
}
|
||||
System.out.println("社員データ:" + employeeCount + "件\n部署データ:" + deptCount + "件");
|
||||
System.out.println();
|
||||
|
||||
System.out.println("メールアドレス表示");
|
||||
for (BaseData data : allData) {
|
||||
if (data instanceof EmployeeData) {
|
||||
System.out.println(((EmployeeData) data).getMailAddress());
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println();
|
||||
|
||||
//nullおよび前後の空白を取り除いた結果が空文字チェック
|
||||
// BaseData emp = new EmployeeData("10000", "デフォルト", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||
// System.out.println(emp);
|
||||
// (EmployeeData)emp.setNmEmployee(null);
|
||||
// System.out.println(emp);
|
||||
// emp.setNmEmployee(" ");
|
||||
// System.out.println(emp);
|
||||
BaseData emp = new EmployeeData("10000", "デフォルト", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||
System.out.println(emp);
|
||||
((EmployeeData) emp).setNmEmployee(null);
|
||||
System.out.println(emp);
|
||||
((EmployeeData) emp).setNmEmployee(" ");
|
||||
System.out.println(emp);
|
||||
|
||||
System.out.println();
|
||||
|
||||
System.out.println("コンストラクタに全てから文字で");
|
||||
BaseData emptyEmployee = new EmployeeData("", "", "", "", "", "");
|
||||
System.out.println(emptyEmployee);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user