我的java代码有一个明显的错误.为什么要编译和运行? [英] My java code has an obvious error. Why does it compile and run?
本文介绍了我的java代码有一个明显的错误.为什么要编译和运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public class HelloWorld {
public static void main (String args[]){
System.out.println ("Hello ");
http://www.google.com
System.out.println ("World!");
}
}
上面的代码只是编译和执行得很好.为什么编译器不报告任何错误?
The above code is just compiling and executing fine. Why the compiler is not reporting any error?
推荐答案
The http:
is a Label Statement. See here also.
//www.google.com
部分随后被解释为 //
注释.
The //www.google.com
portion is then interpreted as a //
comment.
这篇关于我的java代码有一个明显的错误.为什么要编译和运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文