package demo;
public abstract class Shape {
public abstract void draw();
}
abstract class A extends Shape {
abstract void test();
}
class C extends A {
void test() {
}
public void draw() {
}
}
package demo;
public class Cycle extends Shape{
public void draw() {
System.out.println("画一个○!!!!!");
}
}
package demo;
public class Flower extends Shape{
@Override
public void draw() {
System.out.println("画一朵❀!!");
}
}
package demo;
public class Test {
public static void main(String[] args) {
Cycle cycle = new Cycle();
Flower flower = new Flower();
Shape[] shapes = {cycle, cycle, flower, flower};
for (Shape shape : shapes) {
shape.draw();
}
//Shape shape = new Shape();
Shape shape = new Cycle();
}
}