父类:
Tlephone类
package java抽象类;
public abstract class Tlephone {
public abstract void call() ;
public abstract void message();
}
接口类:
IplayGame 类
package java抽象类;
//接口类
public interface IplayGame {
public void play() ;
}
子类:
package java抽象类;
public class Smartphone extends Tlephone implements IplayGame{ //继承父类和接口类
@Override
public void call() {
// TODO Auto-generated method stub
System.out.println("yuying");
}
@Override
public void message() {
// TODO Auto-generated method stub
System.out.println("yuying");
}
@Override
public void play() {
// TODO Auto-generated method stub
System.out.println("wanyouxi");
}
}
package java抽象类;
public class Cellphone extends Tlephone {
@Override
public void call() {
// TODO Auto-generated method stub
System.out.println("jianpan");
}
@Override
public void message() {
// TODO Auto-generated method stub
System.out.println("jianpan");
}
}
接口子类:
package java抽象类;
public class Psp implements IplayGame {
@Override
public void play() {
// TODO Auto-generated method stub
System.err.println("psp");
}
}