class Parent1{
public int p1;
//public Parent1(){
// System.out.println("부모 생성자");
//}
public Parent1(int p1){
System.out.println("부모 생성자");
}
public void methodP1(){
System.out.println("methodP1() 호출");
//System.out.println(p1);
System.out.println("this : "+this);
class Child1 extends Parent1{
public int c1;
public Child1(){
//디폴트 생성자
//super();
super(10); //자식 클래스에서 명시적으로 부모 생성자를 호출
//this();
//super(). this() : 생성자 관련된 내용
System.out.println("자식 생성자");
}
public void methodC1(){
super.methodP1();
System.out.println("methodC1() 호출");
System.out.println("super : "+super.toString());
//this와 참조값이 같음
}
}
public class ExamEx02{
public static void main(String[] args){
Child1 c1 = new Child1();
c1.methodC1();
}
}