File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Why this code compiles fine?

Hemang Thanki
Greenhorn

Joined: Jan 24, 2005
Posts: 18
public class Curiosity {
public static void main (String[]args){
System.out.println ("A curiosity");
http: //www.something.com/howto.html;
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

Hemz
Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131

is a label.

P.


Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why this code compiles fine?