如果不加if,编译器会提示“initializer does not complete normally” 不加if的情况:会报错,显示错误信息:“initializer does not complete normally” classDeadLoopClass{static{System.out.println(Thread.currentThread()+"DeadLoopClass init!!!");while(true){}}} 加if的情况:能编译通过 classDeadLoopClass{sta...
简介: //如果不加if,编译器会提示“initializer does not complete normally”?? 楼上的正解,去掉死循环。 http://bbs.//如果不加if,编译器会提示“initializer does not complete normally”?? 楼上的正解,去掉死循环。 http://bbs.csdn.net/topics/390919143...
For instance, if we try to do so: public class NoChecked { static { throw new Exception(); } } The compiler would fail with the following compilation error: java: initializer must be able to complete normally As a convention, we should wrap the possible checked exceptions inside an ...