1、例子
public class OpenSpecificationAction { // 这部分以下 { System.out.println("run here."); } public static void main(String[] args) { OpenSpecificationAction t = new OpenSpecificationAction(); t.show(); } public void show() { System.out.println("this is show method."); } }
说明:标准叫法 "构造代码块"、它的执行顺序,在static代码块之后,在构造函数之前.即在实例化该对象之前执行。