SCJP4(96%)
SCJP1.4(91%)
Originally posted by Dirk Schreckmann:
An assignment has as return value. For such a return value to work as the boolean test in an if-statement, the return value must be a boolean so the assignment must be a boolean.
But if you run it you will see that Sun is incorrect.Originally posted by Craig Harding:
I agree with Sun and there answer on this question.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Thomas Paul:
But if you run it you will see that Sun is incorrect.
Originally posted by Craig Harding:
I have done many tests with code that uses the assignment operator in this case instead of == .
I have concluded that in any situation where the var=true is used the variable is set to true and the code will meet the condition.
SCJP4(96%)
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
bacon. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|