3790

积分

好友

主题
发表于 2012-11-21 18:19:19 | 查看: 435| 回复: 0
本帖最后由 jsjsj 于 2012-11-21 18:25 编辑

[code=java]public class First {

    public void method2() {
        System.out.println("First2");
    }

    public void method3() {
        method2();
    }
}

public class Second extends First {

    public void method2() {
        System.out.println("Second2");
    }
}

public class Third extends Second {

    public void method1() {
        System.out.println("Third1");
        super.method2();
    }

    public void method2() {
        System.out.println("Third2");
    }
}

public class Fourth extends First {

    public void method1() {
        System.out.println("Fourth1");
    }

    public void method2() {
        System.out.println("Fourth2");
    }
}
[/code]
Capture.JPG
(点击图片可以放大查看)
Capture.JPG
源文档: Josh_inheritance.pdf (293.19 KB, 下载次数: 1)

手机版|Copyright|CSUW

GMT-8, 2019-1-17 05:08 , Processed in 0.059423 second(s), 20 queries .

Powered by CSUW

© 2001-2012 CSUW.ORG

返回顶部