New course! Every coder should learn Generative AI!
Try a free lesson+ 17
Output :
A curiosity compiler OK (?)
Reason :
because of // in http://, www.google.com works as a comment in the entire program. Allowing both the outputs to be printed....(?)
+ 17
There's a point I got :
What's the answer if we change http: to any other name like dhhj: ? Would it work?
+ 16
I'm going for d too because the "jumping goto statement thing" is there but never "called" so I reckon it can be ignored in this case.
(I know the //www.google.com bit is definitely ignored because it's a comment)
+ 16
and what if we don't put a : after http?
+ 16
So, now we're gonna report it to them? 😂
Add label: to the Java course...
+ 14
Adding onto what @Sachin and @Steven have said, the (word): is like a goto statement except that you don't go to it, you go to the line after it (if that makes sense)
+ 10
http: in here looks like goto statement we use in C,
if there exists a goto statement in java also, then the code will run perfectly, else syntax error (Which I thought at first sight).
But in java, break is used in place of goto.
Check-
http://www.aboutcodes.com/2012/07/goto-statement-in-java-with-example.html?m=1
+ 9
the answer is the option d because the http //www.Google.com is treated as comment and it is not executed and system prints the output as option d
+ 7
@Ace, 😂😂 as it is clearly visible that www.google.com is a single line comment followed by // So it is ignored,
now it is only http: which is also ignored but it's not a comment.
Now, tell us what is the reason?
+ 7
Sure it will, because http is just a name
+ 7
@Ace, I gave the same answer, I just didn't specified the word label.
https://stackoverflow.com/questions/2399590/java-what-does-the-colon-operator-do
+ 6
Java thinks http: might be a continue label for an iterative loop. However Java can find no loop referencing the label and so ignores http:.
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html
+ 6
Error,
saying what is http??
+ 6
@Ace, Ooo, ok I'll not forget to remember the terms by now 😊😊
+ 6
Yes, self education does tend to leave holes in one's understanding that might not be rectified without a formal education to go with it.
+ 6
That's too bad @Ace. We need questions like these in our tutorials to stretch our minds. Education mandated by popularity has some obvious drawbacks.
+ 5
Well, I'm more confused than ever but, if the compiler ignores the line starting with http and goes to the next line, then my guess is d. Of course I might be completely wrong and I suspect I probably am.
+ 5
@Ace, it is not in sololearn course?
+ 4
b. error. http is not a command. www.google.com gets commented out.
+ 4
I also go with the answer d