java学习手记

//: Cartoon.java
//Constructor calls during inheritance

class Art {
	Art() {
		System.out.println("Art constructor");
	}
}

class Drawing extends Art {
	Drawing() {
		System.out.println("Drawing constructor");
	}
}

public class Cartoon extends Drawing {
	Cartoon() {
		System.out.println("Cartoon constructor");
	}

	public static void main(String[] args) {
		Cartoon x = new Cartoon();
	}
} // /:~

 java 类

输出结果:

Art constructor

Drawing constructor

Cartoon constructor

你可能感兴趣的:(java)