package dd;
class Person {
Person() {
System.out.println("Person...");
}
// 隱式方法
{
System.out.println("Person hello...");
}
static {
System.out.println("Person static...");
}
}
public class Test extends Person {
Test() {
System.out.println("Test...");
}
{
System.out.println("hello...");
}
static {
System.out.println("static...");
}
public static void main(String[] args) {
System.out.println("main...");
new Test();
}
}
// Person static...
// static...
// main...
// Person hello...
// Person...
// hello...
// Test...
// 編譯過程
// 1.父類靜態屬性
// 2.父類靜態方法體
// 3.子類靜態屬性
// 4.子類靜態方法體
// 5.父類非靜態屬性
// 6.父類非靜態:隱式方法
// 7.父類構造函數
// 8.子類非靜態屬性
// 9.子類非靜態:隱式方法
// 10.子類構造函數
// ================