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.
24 lines
528 B
24 lines
528 B
abstract class Shape{
|
|
public abstract void draw();
|
|
}
|
|
class Rectangle extends Shape{
|
|
public void draw(){
|
|
System.out.println("»Ò»¸ö¾ØÐÎ");
|
|
}
|
|
}
|
|
class Circle extends Shape{
|
|
public void draw(){
|
|
System.out.println("»Ò»¸öÔ²");
|
|
}
|
|
}
|
|
public class Main{
|
|
public static void drawShape(Shape s){
|
|
s.draw();
|
|
}
|
|
public static void main(String[] args){
|
|
Shape shape = new Rectangle();
|
|
drawShape(shape);
|
|
Shape shape2 = new Circle();
|
|
drawShape(shape2);
|
|
}
|
|
}
|