클래스와객체

반응형

    JAVA Basic ) this 예약어

    목차 요약 this예약어는 다음과 같이 활용된다. 1. 자신의 메모리를 카리키는 this. 2. 생성자에서 다른 생성자를 호출하는 this. 3. 자신의 주소를 반환하는 this. 1. 자신의 메모리를 카리키는 this. this는 간단히 설명하면 생성된 인스턴스 스스로를 가리키는 예약어. package thisEx; class BirthDay { int day; int montth; int year; public void setYear(int year) { this.year = year;// bDay.year = year;와 같음 } public void printThis() { System.out.println(this);// this 출력 메서드 (System.out.println(bDay)와 같다..

반응형