程序分析: public class StaticTest { static String name; static { System.out.println(name+"静态代码块"); } { System.out.println(name+"非静态代码块"); } public StaticTest(String a) { name=a; System.out.println(name+"构造方法"); } public void method() { System.out.println(name+"成员方法"); } public static void main(String[] args) { StaticTest s1; StaticTest s2=new StaticTest("s2"); StaticTest s3=new StaticTest("s3"); s3.method(); } } 输出: