aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes q from sun's epractice exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "q from sun Watch "q from sun New topic

q from sun's epractice exam

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303

wht is the result?
What is the result?

x = 0
x = 1
x = 2
x = 3
x = 4
Compilation fails

i answered x = 2. but the correct answer is x=4
i answered x=2, bcos b=false sets the value of b to,doesnt the if loop return true?
plz explain.

SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
"b=false sets the value of b to false"
You are correct, but what is the value of the expression ?

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
It is sorta covered in the JavaRanch Style Guide.
subject: q from sun's epractice exam