cnt的值是( )
public class Test {
static int cnt = 6;
static {
cnt += 9;
}
public static void main(String[] args) {
System.out.println("cnt =" + cnt);
}
static {
cnt /= 3;
};
}cnt=5
cnt=2
cnt=3
cnt=6
static{}代码块在类初始化时执行,多个静态代码块会按顺序执行。