class Parent {}
class Child extends Parent {}super()를 쓰면 부모의 생성자를 호출 할 수 있다.public void gait() throws IOException, SQLException {}public void gait() throws IOException {}class Child22 {
Parent22 p22 = new Parent22(); /* 포함관계 */
}class Parent22 {
int eyes = 2;
public void gait() throws IOException, SQLException {
System.out.println("팔자걸음");
}
}
class Child22 {
Parent22 p22 = new Parent22(); /* 포함관계 */
}
public class Ex22_3_포함관계 {
public static void main(String[] args) {
Child22 c22 = new Child22();
System.out.println(c22.p22.eyes); <- 타고 타서 찾아가기
}
}