Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Why this code compiles fine? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why this code compiles fine? " Watch "Why this code compiles fine? " New topic

Why this code compiles fine?

Hemang Thanki

Joined: Jan 24, 2005
Posts: 18
public class Curiosity {
public static void main (String[]args){
System.out.println ("A curiosity");
http: //;
System.out.println ("compile and run Ok!");
if we take // as comments, what about "http:" ?

why does not compiler throw an error that No symbol found http: ?

Oh great i got it now...

But let it be with this forum. This question should be in SCJP.

It takes http: as the label name...and rest is comment. Gr8...

Oh I Love you Java...ummmah

Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131

is a label.


Get a better web browser:<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Why this code compiles fine?
It's not a secret anymore!