Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

jtips mock 1 Q33  RSS feed

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Magnus, those kind of things are always good to know...
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Neha Sawant
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx Mangus and Valentin
Regards
Neha
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!