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.

19 lines
436 B

package w5;
public class Main {
public static void main(String[] args) {
// 创建图形对象
Circle circle = new Circle();
Rectangle rectangle = new Rectangle();
// 调用统一接口方法
System.out.println("=== 开始绘图 ===");
drawShape(circle);
drawShape(rectangle);
}
public static void drawShape(Shape s) {
s.draw();
}
}