标签:end rgs color 语音 class sys sage ring rac
// Telphone.java public abstract class Telphone{ public abstract void call(); public abstract void message(); } // CellPhone.java public class CellPhone extends Telphone{ @Override public void call(){ System.out.println("键盘打电话"); } @Override public void message(){ System.out.println("键盘发短信"); } } //ModernPhone.java public class ModernPhone extends Telphone{ @Override public void call(){ System.out.println("语音打电话"); } @Override public void message(){ System.out.println("语音发短信"); } } //Test.java public class Test{ public static void main(String[] args){ Telphone te1 = new CellPhone(); te1.call(); te1.message(); Telphone te2 = new ModernPhone(); te2.call(); te2.message(); } }
标签:end rgs color 语音 class sys sage ring rac
原文地址:https://www.cnblogs.com/cjh123/p/12329500.html