왜 super
은 C
의 i
필드에 아무런 영향을 미치지 않으십니까? 출력이 012
이지만, 클래스가 C
을 확장하기 때문에 321
이 아닌 이유는 무엇입니까?분야 용 자바 슈퍼
public class C {
protected int i;
public C(int i){
this(i,i);
System.out.print(this.i);
this.i=i;
}
public C(int i, int j) {
System.out.print(this.i);
this.i=i+j;
}
public C(){
this(1);
System.out.print(i);
}
public static void main(String[] args) {
C c=new C();
}
}
public class B extends C{
public B(){
super.i=3;
}
public static void main(String[] args){
C c=new B();
}
}
이 nesseccary 정말에서
super.testMethod()
전화 방법testMethod
을 수행하여 단지 다른 제목으로 질문을 여러 번 게시 할 수 있을까? –오늘 같은 질문이 –
@Andreas : 글쎄, 그건 같은 질문이 아니에요, 그것은 후속 조치입니다. – Thilo