😔😔用idea写代码,涉及到知识盲区,想问一下具体过程!🙏🙏

img


import java.util.*;
interface Shape{
    float getArea();                            //求面积
    float getCircumference();                   //求周长
}

//Circle类
class Circle implements Shape{
    private final float PI=3.14f;
    private float radius;

    Circle(){}                                  //Circle类构造方法
    Circle(float r){
        radius=r;
    }
    public float getArea(){                     //Circle类求面积
        return PI*radius*radius;
    }
    public float getCircumference(){            //Circle类求周长
        return 2*PI*radius;
    }
}

//Rectangle类
class Rectangle implements Shape{
    private float width;
    private float height;

    Rectangle(){}                               //Rectangle类构造方法
    Rectangle(float width,float height){
        this.width=width;
        this.height=height;
    }
    public float getArea(){                     //Rectangle类求面积
        return width*height;
    }
    public float getCircumference(){            //Rectangle类求周长
        return 2*(width+height);
    }
}

//Square类,继承Rectangle类
class Square extends Rectangle{
    Square(){}                                  //Square类构造方法
    Square(float length){
        super(length,length);
    }

}
class ShapeInterface {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        Shape shape=null;
        //得写“null”,不然输出句会显示说shape:“The local variable shape may not have been initialized”,它是考虑到else中没有初始化shape对象,虽然从我们的逻辑上看在运行中是不会有这样的问题的……

        int y;
        do{
            y=0;
            System.out.println("请选择输入的图形:1、圆形,2、矩形,3、正方形:");
            int x=sc.nextInt();
            //圆形
            if(x==1){
                System.out.println("请输入圆形的半径:");
                float radius=sc.nextFloat();

                shape=new Circle(radius);
            }
            //矩形
            else if(x==2){
                System.out.println("请输入矩形的长和宽,以空格相隔:");
                float width=sc.nextFloat();
                float height=sc.nextFloat();

                shape=new Rectangle(width,height);      
            }
            //正方形
            else if(x==3){
                System.out.println("请输入正方形的边长:");
                float length=sc.nextFloat();

                shape=new Square(length);
            }
            //输入错误
            else{
                y=1;
                System.out.println("输入错误,请重新输入:");
            }
        }
        while(y==1);

        System.out.println("面积:"+shape.getArea()+"\t\t周长:"+shape.getCircumference());

        sc.close();
    }
}

你的题目就是过程,你的知识盲区是指什么?