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

@@ -6,10 +6,12 @@ public class EmployeeData {
private String mailAddress;
private String password;
private String idDepartment;
private static int empCount = 0;
static final String COMPANY_NAME = "Rhizome";
//コンストラクタ
public EmployeeData() {
empCount++;
}
//引数ありコンストラクタ
@@ -21,6 +23,9 @@ public class EmployeeData {
this.setMailAddress(mailAddress);
this.setPassword(password);
this.setIdDepartment(idDepartment);
empCount++;
}
@Override
@@ -78,4 +83,8 @@ public class EmployeeData {
this.idDepartment = idDepartment;
}
public static int getEmpCount() {
return empCount;
}
}