You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
498 B
18 lines
498 B
public class ShapeTest {
|
|
public static void main(String[] args) {
|
|
// 创建各个图形对象
|
|
Shape c = new Circle(5);
|
|
Shape r = new Rectangle(4,6);
|
|
Shape t = new Triangle(3,4);
|
|
|
|
//统一调用工具打印面积
|
|
System.out.print("圆形:");
|
|
ShapeUtil.printArea(c);
|
|
|
|
System.out.print("矩形:");
|
|
ShapeUtil.printArea(r);
|
|
|
|
System.out.print("三角形:");
|
|
ShapeUtil.printArea(t);
|
|
}
|
|
}
|