super

super은 자손 클래스에서 조상 클래스로부터 상속받은 멤버를 참조하는데 사용되는 참조변수이다. this가 자신이 속한 인스턴스를 가리키는 것처럼 super는 자신의 부모 클래스에 대한 참조를 하는 변수이다. super또한 static으로 선언된 클래스 변수 / 메소드에 대해서는 사용할 수 없으며 인스턴스 변수 / 메소드에 대해서만 사용이 가능하다. class Parent1{ int x = 20; int y = 30; } class Child1 extends Parent1{ int y = 10; void method(){ System.out.println("x = " + x); System.out.println("this.x = " + this.x); System.out.println("super.x =..
Hoplin
'super' 태그의 글 목록