wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "q from sun Watch "q from sun New topic
Author

q from sun's epractice exam

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303


wht is the result?
What is the result?





A
x = 0
B
x = 1
C
x = 2
D
x = 3
E
x = 4
F
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 false.so,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
 
Similar Threads
IS if (b ) same as: if (b == true) ???
If condition
fall - through for if-else loop ???
Boolean Question
Sun Sample exam: mistake??