• 코드:
​x
 
1
class Parent {
2
    int a;
3
    
4
    Parent() { a = 10; }
5
    Parent(int n) { a = n; }
6
}
7
​
8
class Child extends Parent {
9
    int b;
10
    
11
    Child() {
12
        //super(40);
13
        b = 20;
14
    }
15
    
16
    void display() {
17
        System.out.println(a);
18
        System.out.println(b);
19
    }
20
}
21
​
22
public class prog {
23
    public static void main(String[] args) {
24
        Child ch = new Child();
25
        ch.display();
26
    }
27
}
표준입력 & 실행옵션