新手在线求救
陌路彼此 2018-07-17 04:09:11 public class InterfaceTester {
public static void main(String[] args) {
// TODO Auto-generated method stub
Rectangle rect= new Rectangle (5,6);
System.out.println("Are of rect = " + rect.area());
Circle cir = new Circle(2.0);
System.out.println("Area of cir = " + cir.area());
}
}
interface Shape2D {
double pi=3.14;
double area ();
}
class Circle implements Shape2D {
private double redius;
public Circle (double r) { //构造方法
redius = r;
}
public double area() {
return (pi * redius * redius);
}
}
class Rectangle implements Shape2D {
int width,height;
public Rectangle (int w,int h) {
width =w;
int height = h;
}
public double area() {
return (width * height);
}
}
运行后出现错误Exception in thread "main" java.lang.NoSuchMethodError: zhouer1.Circle.<init>(D)V
at zhouer1.InterfaceTester.main(InterfaceTester.java:9)
求大佬解答!