서론
클래스의 구성요소
클래스는 상태와 행위를 가지며 상태를 필드(Field)
, 행위를 메소드(Method)
라고 함
클래스에는 필드와 메소드 외에 생성자(Constructor)
라는 특수한 메소드도 반드시 하나 이상 가짐
public class Employee {
// Fields
private String name;
private String department;
// Constructor
public Employee(String name, String department) {
this.name = name;
this.department = department;
}
// Method
public void work() {
...
}
}