类加载 静态加载

 

public class StaticTest {
     
    static int j=2;
    static{
         j=3;
         System.out.println(j);
    }
    public StaticTest() {
        // TODO Auto-generated constructor stub
        j=9;
        System.out.println(j);
    }
    public static void main(String[] args) {
        System.out.println("hello");
        new StaticTest();
    }
}

3
hello
9

 

 

posted @ 2020-04-30 10:49  kakaisgood  阅读(175)  评论(0)    收藏  举报