Constructor (1) 썸네일형 리스트형 Week4) Java Programming Lab : Class and Instance (2) Class Constructor 모든 클래스는 반드시 하나 이상의 contructor을 가짐 사용자가 클래스 선언시 구성자를 선언하지 않은 경우 자바 컴파일러가 디폴트 구성자를 만듦 초기에 멤버 변수를 초기화 모든 변수를 초기화하지 않은 경우, 초기화되지 않은 값은 디폴트 값으로 자동 설정 this 모든 객체는 자기 자신을 참조할 때 this 키워드를 사용 2. constructor, set, get example public class StuentData { private String StudentName; private int StudentID; private int StudentAge; // constructor1 - 변수 초기화 public StudentData(){ StudentName = "N.. 이전 1 다음