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
356 B
19 lines
356 B
abstract class Shape {
|
|
public abstract void draw();
|
|
}
|
|
|
|
// 2. 圆形类
|
|
class Circle extends Shape {
|
|
@Override
|
|
public void draw() {
|
|
System.out.println("绘制一个圆形 🟡");
|
|
}
|
|
}
|
|
|
|
// 3. 矩形类
|
|
class Rectangle extends Shape {
|
|
@Override
|
|
public void draw() {
|
|
System.out.println("绘制一个矩形 🟦");
|
|
}
|
|
}
|