因为for不能正常结束,导致println那句不可达~~为啥不能正常结束?标准上关于for正常终止是这样说的: A basic for statement can complete normally iff at least one of the following is true: .The for statement is reachable, there is a condition expression(LZ没有条件表达式), and the condition expression is not a constant expression with value true. .There is a reachable break statement that exit the for statement.(LZ也没有break跳出for循环) 综上:Systemm.out.println(n)不可达。
这个我当初也想过。可是这个呢。这个是能编译成功的哦; int n = 100; while(n>0){} System.out.println(n); 不知道是什么原因,望解答。谢谢了。
A basic for statement can complete normally iff at least one of the following is true:
.The for statement is reachable, there is a condition expression(LZ没有条件表达式), and the condition expression is not a constant expression with value true.
.There is a reachable break statement that exit the for statement.(LZ也没有break跳出for循环)
综上:Systemm.out.println(n)不可达。
int n = 100;
while(n>0){}
System.out.println(n);
不知道是什么原因,望解答。谢谢了。