필드 변수

    [06] 프로그램 설계 방법론(생성자와 필드 변수)

    주제 : 생성 메서드와 필드 변수 생성 메서드(constructor method) : 객체가 태어나면서 저절로 한번 실행하는 메서드를 뜻한다. 생성 메서드를 만들 때는 클래스 이름과 동일하게 만든다. public class ClassName { public ClassName( par_1, …, par_n) { // 몸체 코드 블록 } } 실습 : 아날로그 시계를 만들어보자 import javax.swing.*; public class ClockWriter extends JPanel{ public ClockWriter() { JFrame frame = new JFrame(); frame.setTitle("Clock"); frame.setSize(300, 400); frame.setVisible(true);..