Java 类的加载

package com.cwcec.p2;

class C
{
    public static final int SIZE;
    static
    {
        SIZE = 100;
        System.out.println("A static...");
    }
}

class Instrument
{
    public Instrument()
    {
        System.out.println("Instrument construction...");
    }
}

public class Wind
{
    public static String S;
    static
    {
        S = "abc";
        System.out.println(S);
    }
    public static void main(String[] args) 
    {
        
        Instrument instrument = new Instrument();
        int t = C.SIZE;
        System.out.println("Wind " + t);
    }
}

输出结果:

abc
Instrument construction...
A static...
Wind 100

posted @ 2018-01-17 15:33  darrell007  阅读(115)  评论(0编辑  收藏  举报