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.
13 lines
390 B
13 lines
390 B
public class Main {
|
|
public static void main(String[] args) {
|
|
// 创建图形对象
|
|
Shape circle = new Circle(6);
|
|
Shape rectangle = new Rectangle(7, 9);
|
|
Shape triangle = new Triangle(7, 10);
|
|
|
|
// 统一计算并打印面积
|
|
ShapeUtil.printArea(circle);
|
|
ShapeUtil.printArea(rectangle);
|
|
ShapeUtil.printArea(triangle);
|
|
}
|
|
}
|
|
|