aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/test2/Inherit.java
blob: b310730ba3c01bf5a21224c93efb42e0c1a2908b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package test2;

interface Inherit1 {
    void foo1();
}

interface Inherit2 extends Inherit1 {
    void foo2();
}

abstract class Inherit3 implements Inherit2 {
    abstract void foo3();
}

public class Inherit extends Inherit3 {
    public void foo1() { System.out.println("foo1"); }
    public void foo2() { System.out.println("foo2"); }
    public void foo3() { System.out.println("foo3"); }

    public static void main(String args[]) {
        Inherit i = new Inherit();
        Inherit2 i2 = i;
        i.foo2();
        i2.foo1();
    }
}