java.lang.Comparable<Shape>
public abstract class Shape extends java.lang.Object implements java.lang.Comparable<Shape>
Constructor | Description |
---|---|
Shape() |
Modifier and Type | Method | Description |
---|---|---|
abstract double |
calculateArea() |
Abstract method that returns the area of polygon.
|
abstract double |
calculatePerimeter() |
Abstract method that returns the perimeter of polygon.
|
int |
compareTo(Shape shape) |
compareTo method required for implementing the Comparable interface
Return:
-1 from compareTo if the area of this Shape is less than the area of the Shape parameter
0 from compareTo if the area of this Shape equals the area of the Shape parameter
1 from compareTo if the area of this Shape is greater than the area of the Shape parameter
|
public abstract double calculateArea()
public abstract double calculatePerimeter()
public int compareTo(Shape shape)
compareTo
in interface java.lang.Comparable<Shape>
shape
-