Q33 from jtips mock 1 I thought it should give compiler error,statement not reached but ans given is 18. Please help Given:
What is the Output? 1.Prints 10 2.Prints 28 3.Compile-time error occurs. 4.Prints 18. 5.Prints 27 regards neha
(Marilyn added code tags) [This message has been edited by Marilyn deQueiroz (edited November 27, 2001).]
nss
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
Answer is wrong. It gives a compile error. Try to compile the code and you'll see it. The only construct with which you can use false is with "if" so that you may insert debug conditional compilation. HIH ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform
If you use JBuilder, it'll compile (but the statement will hopefully be optimized away), but if you use SUN's own compiler (javac) you'll get the error. Guess the author of the mock-exam uses JBuilder or something similar.
Originally posted by Valentin Crettaz: [b]Answer is wrong. It gives a compile error. Try to compile the code and you'll see it. The only construct with which you can use false is with "if" so that you may insert debug conditional compilation. HIH [/B]
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
Thanks Magnus, those kind of things are always good to know... ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform