class Parent {
int x=100;
Parent() {
this(200);
}
Parent(int x) {
this.x=x;
}
int getX() {
return x;
}
}
class Child extends Parent {
int x=3000;
Child() {
this(1000);
}
Child(int x) {
this.x=x;
}
}
public class Main {
public static void main(String[] args) {
Child c = new Child();
System.out.println(\"x=\"+c.getX());
}
}
Child()생성자 처음 호출-> child(int x) 생성자 호출-> super()생성자 호출-> parent(int x)생성자 호출-> child(int x)에서 this.x=1000이 돼서 1000이 나와야 하는 거 아님?
왜 200이 뜨는지 모르겠음
println 찍어보셈~
그렇게 해봐도 모르겠네ㅜㅜ