静态代码块:
格式:
static { //静态代码块中的执行语句。 }
特点:随着类的加载而执行,只执行一次,并优先于主函数(main)和构造代码块。
class StaticCode { static { System.out.println("a"); } }