请问这个是什么错误,怎么解决,我继承的时候出现了这个问题
Implicit super constructor Rectangular() is undefined for default constructor. Must 
define an explicit constructor

解决方案 »

  1.   

    不懂这是代码:public interface Shape
    {
    public float Area();
    public float Circumference();
    }
    class Rectangular implements Shape
    {
    private  float Long;
    private  float Wide;
    public static void Sum()
    {
    int num = 1;
    num++;
    System.out.println("实例化个数为:"+num);
    }
    public Rectangular(float Long,float Wide)
    {
    this.Long=Long;
    this.Wide=Wide;
    }

    public float Area()
    {
    return Long*Wide;
    }
    public float Circumference()
    {
    return Long+Long+Wide+Wide;
    }
    public void ShowInfo()
    {
    System.out.println("面积是"+Long*Wide);
    System.out.println("周长是"+(Long+Long+Wide+Wide));
    }
    }
    class Square extends Rectangular{ private float Side;
    public float Area()
    {
    return Side*Side;
    }
    public float Circumference()
    {
    return 4*Side;
    }
    }
      

  2.   


    // 给你个例子,自己看吧
    public interface Shape2D {
    final double pi = 3.14; public abstract double area();
    }class Circle implements Shape2D {
    double radius; public Circle(double r) {
    radius = r;
    } public double area() {
    return pi * radius * radius;
    }
    }class Rectangle implements Shape2D {
    double width, height; public Rectangle(double w, double h) {
    width = w;
    height = h;
    } public double area() {
    return width * height;
    }
    }public class InterfaceTest {
    public static void main(String[] args) {
    System.out.println("Example 1:");
    Rectangle rect = new Rectangle(5, 6);
    System.out.println("The rect area = " + rect.area());
    Circle cir = new Circle(2);
    System.out.println("The cir area = " + cir.area()); System.out.println("Example 2:");
    Shape2D var1, var2;
    var1 = new Rectangle(5, 6);
    System.out.println("The Rectangle area = " + var1.area());
    var2 = new Circle(2);
    System.out.println("The Circle area = " + var2.area());
    }
    }
      

  3.   

    改成这样就行了:import java.util.*;
    import java.lang.*;interface Shape
    {
    public float Area();
    public float Circumference();
    }
    public class Rectangular implements Shape
    {
    private float Long;
    private float Wide;
    public static void Sum()
    {
    int num = 1;
    num++;
    System.out.println("实例化个数为:"+num);
    }
    public Rectangular(float Long,float Wide)
    {
    this.Long=Long;
    this.Wide=Wide;
    }
    public Rectangular()
    { }
    public float Area()
    {
    return Long*Wide;
    }
    public float Circumference()
    {
    return Long+Long+Wide+Wide;
    }
    public void ShowInfo()
    {
    System.out.println("面积是"+Long*Wide);
    System.out.println("周长是"+(Long+Long+Wide+Wide));
    }
    }
    class Square extends Rectangular{ private float Side;
    public float Area()
    {
    return Side*Side;
    }
    public float Circumference()
    {
    return 4*Side;
    }
    }
      

  4.   

    public interface Shape
    {
    public float Area();
    public float Circumference();
    }
    class Rectangular implements Shape

    private float Long;
    private float Wide;
    public static void Sum()
    {
    int num = 1;
    num++;
    System.out.println("实例化个数为:"+num);
    }
    public Rectangular(float Long,float Wide)
    {
    this.Long=Long;
    this.Wide=Wide;
    }public Rectangular() { //缺省参数的构造器
        this(0, 0);
    }

    public float Area()
    {
    return Long*Wide;
    }
    public float Circumference()
    {
    return Long+Long+Wide+Wide;
    }
    public void ShowInfo()
    {
    System.out.println("面积是"+Long*Wide);
    System.out.println("周长是"+(Long+Long+Wide+Wide));
    }
    }
    class Square extends Rectangular{ //如果Rectangular没有缺省的构造器,这里就不能Square的构造器,而且要在Square的构造器中显式调用Rectangular构造器
    private float Side;
    public float Area()
    {
    return Side*Side;
    }
    public float Circumference()
    {
    return 4*Side;
    }
    }