#
package edu.javase.buffer;
interface faces {
public void facefun1();
public int facefun2();
public String facefun3();
}
interface faces2 {
public void facefun11();
public int facefun22();
public String facefun33();
}
class fatherz {
public fatherz() {
System.out.println("fatherz 构造器");
}
public fatherz(int i) {
System.out.println("fatherz int i 构造器" + i);
}
public void fatherfun() {
System.out.println("fatherfun");
}
}
class demoface extends fatherz implements faces, faces2 {// 一旦集成必须实现所有接口
public demoface() {
super();
System.out.println("demoface 构造器");
}
public demoface(int i) {
super(1);
System.out.println("demoface int i 构造器" + i);
}
@Override
public void facefun1() {
System.out.println("实现接口 facefun1");
}
@Override
public int facefun2() {
System.out.println("实现接口 facefun2");
return 0;
}
@Override
public String facefun3() {
System.out.println("实现接口 facefun3");
return null;
}
@Override
public void facefun11() {
System.out.println("实现接口 facefun11");
}
@Override
public int facefun22() {
System.out.println("实现接口 facefun22");
return 0;
}
@Override
public String facefun33() {
System.out.println("实现接口 facefun33");
return null;
}
}
public class demointerface {
public static void main(String[] args) {
demoface dd = new demoface();
dd.facefun1();// 调用接口,并且实现
dd.facefun2();
dd.facefun3();
dd.facefun11();
dd.facefun22();
dd.facefun33();
System.out.println("----------------");
demoface ff = new demoface(5);
ff.fatherfun(); // 同事继承father
}
}
#
#
#
#