代码如下:
class Art{
Art(){
System.out.println("Art");
}
}
class Drawing extends Art{
Drawing(){
System.out.println("Drawing");
}
}
public class Cartoon extends Drawing {
Cartoon(){
System.out.println("Cartoon");
}
public static void main(String[] args) {
Art cartoon = new Cartoon();
}
}
输出为:
代码如下:
Art
Drawing
Cartoon
猜你喜欢