呼叫大侠们 帮小弟看看
本题是实现接口的问题 {另外想请教下继承抽象类的我是用(比如public class void A来继承前面的abstract) 不知道是哪里错了 呵呵}
interface A{
public abstract void f(int x);
public abstract void g(int x,int y);
public abstract double h(double x);
}
class A1 implements A{
public void f(int x){
System.out.println("我是A1_x");
}
public void g(int x,int y){
System.out.println("我是A1_xy");
}
public void h(double x){
System.out.println("我是A1_x");
}
}
class A2 implements A{
public void f(int x){
System.out.println("我是A2_x");
}
public void g(int x,int y){
System.out.println("我是A2_xy");
}
public void h(double x){
System.out.println("我是A2_x");
}
}
class A3 implements A{
public void f(int x){
System.out.println("我是A3_x");
}
public void g(int x,int y){
System.out.println("我是A3_xy");
}
public void h(double x){
System.out.println("我是A3_x");
}
}
public class B{
public static void main(String args[]){
A1 a1=new A1();
A2 a2=new A2();
A3 a3=new A3();
System.out.println(" "+a1.f(1)+" "+a1.g(1,2)+" "+a1.h(1.2));
System.out.println(" "+a2.f(1)+" "+a2.g(1,2)+" "+a2.h(1.2));
System.out.println(" "+a3.f(1)+" "+a3.g(1,2)+" "+a3.h(1.2));
}
}