java - 所包含的声明是什么?

标签 java jls

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/

相关文章:

java - 变换+缩放一组点

java - 如何将 JAR 添加到我正在开发的 Eclipse 插件中?

java - Spring Boot 错误 : java. lang.NoClassDefFoundError: org/springframework/util/Assert

java - 为什么会出现这种情况下拆箱的情况呢?

java - 为什么我的 if 条件不接受 java 中的整数?

java - Android Oreo 通知崩溃系统 UI

Java 继承 : the strict default-abstract and default-default conflict rules

java - 程序顺序规则在构造函数中起作用之前是否发生?

java - java中的 "qualified this"构造是什么意思?

java - JLS:包关键字之前的修饰符