Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My java code has an obvious error. Why does it compile and run?

Tags:

java

syntax

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?

like image 663
Chromium Avatar asked Dec 08 '10 08:12

Chromium


1 Answers

The http: is a Label Statement. See here also.

The //www.google.com portion is then interpreted as a // comment.

like image 146
razlebe Avatar answered Sep 17 '22 20:09

razlebe