2016.7.15接口的练习题
package 纯净水净化系统;
class water{
water(){
System.out.println("水从水池里提出来");
}
}
interface Function {//接口的定义
public abstract void waterFiltration();
public abstract void waterBuffer();
public abstract void waterHeat();
public abstract void waterSuger();
}
class Equipment extends water implements Function {//子类继承了父类的公共功能又实现了特定的功能
public void waterFiltration(){
System.out.println("把水过滤");
}
public void waterBuffer(){
System.out.println("把水缓冲");
}
public void waterHeat(){
System.out.println("把水加热");
}
public void waterSuger(){
System.out.println("往水里加糖");
}
}
public class Text{
public static void main(String[] args){
Equipment a=new Equipment();
a.waterBuffer();
a.waterFiltration();
a.waterHeat();
a.waterSuger();
}
}