public class ShapeUtil { // 参数类型是Shape,传Circle/Rectangle/Triangle都可以 → 这就是多态! public static void printArea(Shape shape) { System.out.printf("面积为:%.2f%n", shape.getArea()); } }