38
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?

0

2 Answers 2

62

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

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

Sign up to request clarification or add additional context in comments.

Comments

15

Because http: it consider it as label and then rest part are under comment

Basic Usage of Label :

label1:
for(){
  label2:
  for(){
      if(condition1)
      break label1;//break outerloop

      if(condition2)
      break label2;//break innerloop
  }
}    

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.