Static block / variable;
Instance block / variable;
Constructor;
public class StaticTest { public static void main(String[] args) { // System.out.println(B.a); // System.out.println(C.c); StaticTest staticTest = new StaticTest(); staticTest.printName(); } static { System.out.println("Static_block_Main"); } public StaticTest() { System.out.println("Consturctor_Main"); } private void printName() { System.out.println("InstanceMethod"); } { System.out.println("Instance_block_Main"); } }
Output is:
Static_block_Main
Instance_block_Main
Consturctor_Main
InstanceMethod
养老保险、医疗保险、失业保险,住房公积金翻译 <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.