qq_风之幻想_0
2018-02-26 10:28
哪个大佬能不能把完整的代码发出来让我看一下,我自己一个菜鸟,好多地方写不出来
//People类 package com.immoc; public class People { public void say() { System.out.println("人类具有说话的能力"); } } //Chinese类 package com.immoc; public class Chinese extends People { public void say() { System.out.println("中国人说中国话"); } } //American类 package com.immoc; public class American extends People { public void say() { System.out.println("美国人说英语"); } } //Test类 package com.immoc; public class Test { public static void main(String[] args) { People ch=new Chinese(); People am=new American(); ch.say(); am.say(); } } //APeople类 package com.immoc; public abstract class APeople { public abstract void say(); }
使用APeople类的时候把Chinese,American,Test类中的People改成APeople
Java入门第二季 升级版
530650 学习 · 6091 问题
相似问题