public class Test { static { System.out.println("static block"); } public Test() { System.out.println("constructor"); } { System.out.println("block"); } public static void main(String[] args) { new Test(); new Test(); } }
static { try { System.loadLibrary("DLL文件"); } catch (Exception e) { System.out.println("加载DLL失败:" + e.getMessage()); } }