JLS 14.21用于无法到达的语句的规则的描述中,某些包含的语句。为了更具体,我将引用一段话:
A while statement can complete normally iff at least one of the following is true:
The while statement is reachable and the condition expression is not a constant expression (§15.28) with value true.
There is a reachable break statement that exits the while statement.
The contained statement is reachable iff the while statement is reachable and the condition expression is not a constant expression whose value is false.
我怀疑这只是一段时间的整个 block 语句,例如以下内容:
while(true){
//Something
}
这就是包含语句,由括号括起来的所有代码组成,是吗?
最佳答案
在您的示例中,包含的语句将是 \\something
,即循环体。如果您阅读JLS #14.12表达式包含语句也被使用,并且它的含义在该上下文中可能更清晰。
关于java - 所包含的声明是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26363887/