| Author |
SCJP Brainteaser (12)
|
Ankur Sharma
Ranch Hand
Joined: Dec 27, 2005
Posts: 1234
|
|
What this code will do.. Will it compile or not. Enjoy Brainteaser. Will come with some more
|
The Best way to predict your future is to create it
Ankur Sharma
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
Hi Sharma Ji, The above code won't compile as you are using a label http: not for a loop but for a statement. Thanks.
|
SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
|
 |
Asha Lilliete
Greenhorn
Joined: Jun 28, 2006
Posts: 6
|
|
The given code is getting compiled The thing is the label cannot be used.
|
 |
Saurabh Vyas
Ranch Hand
Joined: Sep 02, 2003
Posts: 72
|
|
I think the code should compile as it is a valid label and label can be used anywhere. Good question. a real googly [ November 14, 2006: Message edited by: Saurabh Vyas ]
|
 |
rajanikar reddy
Greenhorn
Joined: Oct 15, 2006
Posts: 1
|
|
|
I think code will compile
|
 |
Ankur Sharma
Ranch Hand
Joined: Dec 27, 2005
Posts: 1234
|
|
Originally posted by rajanikar reddy: I think code will compile
Really !!! Could you also pour your thoughts behind this reason.
|
 |
Rajesh Kadle
Greenhorn
Joined: Sep 06, 2004
Posts: 26
|
|
Code will compile. http : is treaded as label www.google.com; is commented out in //www.google.com;
|
-Raj
|
 |
Ankur Sharma
Ranch Hand
Joined: Dec 27, 2005
Posts: 1234
|
|
Originally posted by Rajesh Kadle: Code will compile. http : is treaded as label www.google.com; is commented out in //www.google.com;
Then this means this code will also compile What are your thoughts now. Now you can use your PC to check what are the things which are really going on.
|
 |
Saurabh Vyas
Ranch Hand
Joined: Sep 02, 2003
Posts: 72
|
|
This code will not compile as there is no valid java statement after the label. There should be atleast one valid java statement after the label which has semi-colon at the end.
|
 |
Harshad Khasnis
Ranch Hand
Joined: Jun 06, 2006
Posts: 48
|
|
[/CODE] No Sharma Ji that certainly not going to compile, but yes this one sure will compile, [ November 15, 2006: Message edited by: Harshad Khasnis ]
|
 |
Ankur Sharma
Ranch Hand
Joined: Dec 27, 2005
Posts: 1234
|
|
Originally posted by Saurabh Vyas: This code will not compile as there is no valid java statement after the label. There should be atleast one valid java statement after the label which has semi-colon at the end.
here we end up by this thread. Very good Catch Saurabh . That was the only point in this question. Now Enjoy other BrainTeasers.
|
 |
 |
|
|
subject: SCJP Brainteaser (12)
|
|
|