考虑这个功能:
public boolean foo(){
System.exit(1);
//The lines beyond this will not be read
int bar = 1; //L1
//But the return statement is required for syntactically correct code
return false; //L2
//error here for unreachable code
//int unreachable = 3; //L3
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么L1和L2明显无法访问不会发出警告但L3会发出警告.