public abstract class Shape{
protected Point position;
public Shape (Point p)
{
this.position=new Point(p);
}
public abstract int getArea();
public abstract int gerPerimeter();
public abstract boolean overlap(Shape other);
}
public class Rectangle extends Shape
{
public int width;
public int height;
public Rectangle(Point position,int width,int height)
{
super(position);
this.width=width;
this.height=height;
}
@Override
public int getArea()
{
return width*height;
}
@Override
public int getPerimeter()
{
return width*2+height*2;
}
@Override
public boolean overlap(Rectangle other)
{
return false;
}
}
Rectangle.java:1: error: Rectangle is not abstract and does not override abstract method overlap(Shape) in Shape抽象クラスのエラーは、単純なクラス
public class Rectangle extends Shape
^Rectangle.java:17: error: method does not override or implement a method from a supertype
@Override
^Rectangle.java:22: error: method does not override or implement a method from a supertype
@Override
^3 errors