看代碼執行結果

public class B
{
    public static B t1 = new B();
    public static B t2 = new B();
    {
        System.out.println("構造塊");
    }
    static
    {
        System.out.println("靜態塊");
    }
    public static void main(String[] args)
    {
        B t = new B();
    }
}

執行結果:class

構造塊
構造塊
靜態塊
構造塊static

相關文章
相關標籤/搜索