This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
wood burning stoves
 
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??