URL in Java 代码体没有抛出编译错误

URL in Java code body throws no compile errors

在下面的代码块中,http://dray92.github.io 应该会引发编译器错误。这里发生了什么?

public void foo() {
    String s = "hi";
    int x = 3 + 2;

    http://dray92.github.io

    double d = 3.14;
    System.out.println(s + " " + x + " " + d);
}

Java有一个labels的概念。在这个例子中,标签是 http 并且其后的 //dray92.github.io 被简单地视为注释。

如果您需要从 http 跳到这一行,比方说 for 循环,您只需键入 break http;

在java中,仅为迭代语句和switch语句提供标签。它不像C的标签。

one: for(....){
    two: for(....){
        break one;           // it will break iteration of first for loop
    }
}