北京交通大学论坛-知行信息交流平台

 找回密码
 注册
快速进入版块与发帖 搜索
查看: 3046|回复: 2

[作业贴] ThinkingInJava第四版第10章练习第六题

[复制链接]
发表于 2011-6-12 14:59 | 显示全部楼层 |阅读模式
package exercises.Charpter10;

import Six2.Six2;

public class Six {
    public static void main(String[] args){
        Six2 test = new Six2();
        test.getTest().func();
    }
}


 楼主| 发表于 2011-6-12 14:59 | 显示全部楼层
package Six1;

public interface Six1 {
        void func();
}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-6-12 14:59 | 显示全部楼层
package Six2;

import Six1.*;

public class Six2 {

        protected class Test implements Six1{
                public void func() {
                        System.out.println("Six2 test");
                }
        }
       
        public Six1 getTest(){
                return new Test();
        }
}
回复 支持 反对

使用道具 举报

手机版|北京交通大学论坛-知行信息交流平台 ( BJTUICP备13011901号 )

GMT+8, 2023-12-7 18:08

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表