1. 程式人生 > >Java 初始化基類

Java 初始化基類

class Art{
	Art(){System.out.println("Art constructor");}
}
class Drawing extends Art{
	Drawing(){System.out.println("Drawing constructor");}
}
public class Cartoon extends Drawing {
	public Cartoon(){System.out.println("Cartoon construct");}
	public static void main(String[]args){
		Cartoon x = new Cartoon();
	}
}
/*
 *構造是從基類向外擴散的。 
 */