• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jtips mock 1 Q33

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx Mangus and Valentin
Regards
Neha
 
reply
    Bookmark Topic Watch Topic
  • New Topic