A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

初来乍到,还不懂怎么做。。。。
回复 使用道具 举报
领题~~~~
回复 使用道具 举报
我也来试一试
回复 使用道具 举报
答案已上传,请查收

Test.zip

33.85 KB, 下载次数: 78

点评

谢谢~~~  发表于 2015-6-10 17:12

评分

参与人数 1技术分 +1 收起 理由
王震阳老师 + 1 赞一个!

查看全部评分

回复 使用道具 举报
赞赞,领题
回复 使用道具 举报
领题                                         
回复 使用道具 举报
嗯。。。。。。。。。。。。。。。。。
回复 使用道具 举报
public class XiaoHong {
        public static void main(String[] args) {
                Father father = new Father("male");
                Mother mother = new Mother("female");

                father.jobA();
                father.jobB();
                mother.jobC();
                mother.jobD();

                Person xiaoHong = new Person("female", father, mother);

                System.out.println("小红 is a " + xiaoHong.sex);
        }        
}

class Person {
        String sex;

        public Person(String sex, Object Father, Object Mother) {
                this.sex = sex;
        }

        public Person(String sex) {
                this.sex = sex;
        }
}

class Mother extends Person implements JobC, JobD {

        public Mother(String sex) {
                super(sex);
        }

        public void jobC() {
                System.out.println("小红爸 works jobC");
        }

        public void jobD() {
                System.out.println("小红爸 works jobD");
        }
}        

class Father extends Person implements JobA, JobB {

        public Father(String sex) {
                super(sex);
        }

        public void jobA() {
                System.out.println("小红妈 works jobA");
        }

        public void jobB() {
                System.out.println("小红妈 works jobB");
        }
}

interface JobA {
        public void jobA();
}

interface JobB {
        public void jobB();
}

interface JobC {
        public void jobC();
}

interface JobD {
        public void jobD();
}


1.jpg (51.41 KB, 下载次数: 4)

1.jpg
回复 使用道具 举报
怎样领题呢
回复 使用道具 举报
看一看,学习。
回复 使用道具 举报
好想去大上海啊!环境条件很不错啊!{:2_42:}
回复 使用道具 举报
要向杨哥学习咯
回复 使用道具 举报
领题目。。。
回复 使用道具 举报
领技术分喽
回复 使用道具 举报
阳哥总是这么霸气。刚刚的。
回复 使用道具 举报
老规矩,回帖领题
回复 使用道具 举报
领题 过期没
回复 使用道具 举报
回帖领题
回复 使用道具 举报
拿题              
回复 使用道具 举报
。。。。。。。。。。。。。。。。。沉贴
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马