这里讲解下静态静态代码块,构造代码块,和局部代码块,
package com.founder.sun; public class Demo06 { public static String name; static{ System.out.println("1"); name = "s"; } { System.out.println("hello 2 "); } public static void main(String[] args) { Demo06 demo06 = new Demo06(); System.out.println(demo06.name); demo06.name = "szy"; Demo06 demo0602 = new Demo06(); System.out.println(demo0602.name); { System.out.println("hello 1 "); } } }