代码(抽象类)
public abstract class Language {
public abstract void speak();
}
public class Chinese extends Language {
public void speak() {
System.out.println("中国人说中国话");
}
}
public class Amerrican extends Language {
public void speak() {
System.out.println("美国人说英语");
}
}
public class Initual {
public static void main(String[] args) {
Language lan1 = new Chinese();
lan1.speak();
Language lan2 = new Amerrican();
lan2.speak();
}
}