Files
004_comission/_resources/it114105/itp4510/Lab01/Lab1.2/q3/TestShape.java
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

12 lines
480 B
Java

public class TestShape {
public static void main(String[] args) {
Shape[] myShapes = new Shape[3];
myShapes[0] = new Circle(10.5, 20, 25);
myShapes[1] = new Rectangle(30.5, 23.5, 15.5, 20.5);
myShapes[2] = new Circle(8, 9.5, 10.5);
for (int i = 0; i < myShapes.length; i++) {
System.out
.println(myShapes[i].getName() + "=" + myShapes[i].toString() + "; Area=" + myShapes[i].getArea());
}
}
}