가장 중요하게는 java beans 규약을 따르기 위해
public class Person {
private String name;
private int age;
public Person() {}
public Person(String name, int age) {
super();
this.name = name;
this.age = age;
}
...
}
public class Employee extends Person {
private String department;
public Employee() {
super(); // 부모 클래스의 기본 생성자 호출
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
}