7段階目(staticで社員データの件数を数えよう)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user