7段階目(staticで社員データの件数を数えよう)

This commit is contained in:
s-sakiyama
2026-09-15 14:03:03 +09:00
parent f143cf7ec2
commit 3b6b23c883
2 changed files with 18 additions and 6 deletions

View File

@@ -1,17 +1,19 @@
public class Main {
public static void main(String[] args) {
EmployeeData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ",
"yamada@hoge.jp", "aaa", "10");
System.out.println(employee);
System.out.println("会社名:" + EmployeeData.COMPANY_NAME);
// EmployeeData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ",
// "yamada@hoge.jp", "aaa", "10");
// System.out.println(employee);
//
// System.out.println();
EmployeeData[] employees = new EmployeeData[5];
for (int i = 0; i < employees.length; i++) {
employees[i] = new EmployeeData();
}
System.out.println();
employees[0].setIdEmployee("10000");
employees[0].setNmEmployee("山田龍也");
employees[0].setKnEmployee("ヤマダタツヤ");
@@ -51,6 +53,7 @@ public class Main {
System.out.println(e);
;
}
System.out.println("現在の社員のデータ件数:" + EmployeeData.getEmpCount() + "件");
}