1. 오늘의 주제 : 교수님 책 누가 가져갔나!!
2. 오늘의 부주제 : 교수님이 교통사고로 낚이셨다!!
3. this, this() 의 쓰임
4. Exam_01 예제
package c0330;
class Exam_01_Sub {
소스보기
private int x;
private int y;
public Exam_01_Sub() { // 디폴트 생성자
x = 100;
y = 200;
}
public Exam_01_Sub(int x, int y) { // 두개의 인수를 받는 생성자
this.x = x;
this.y = y;
}
public void disp() {
System.out.println("x = " + x);
System.out.println("y = " + y);
}
};
public class Exam_01 {
public static void main(String[] args) {
소스보기
Exam_01_Sub es1 = new Exam_01_Sub();
es1.disp();
System.out.println();
Exam_01_Sub es2 = new Exam_01_Sub(200, 1000);
es2.disp();
}
}
05. static
- static 필드 : 클래스 이름으로 접근 가능, 객체 발생 전 메모리 할당
JCreator
2007/03/30 10:06
2007/03/30 10:06
Trackback Address :: 이 글에는 트랙백을 보낼 수 없습니다