Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.701 :

Posted: Sun Feb 02, 2014 8:42 am
by devlam
When answering this question I was in doubt:
will b2 = b1 first be evaluated and then the rest of the expression which then become b2 != b2,
or will b1 != b2 first be evaluated putting the result in b2.
With b1 and b2 both being false the result is the same, but if b1 had been true initially it would have been different.
I answered correct but don't know the real rule with such expressions. Can you provide that?

Re: About Question com.enthuware.ets.scjp.v6.2.701 :

Posted: Sun Feb 02, 2014 10:22 pm
by admin
Details of evaluation order are given here: http://docs.oracle.com/javase/specs/jls ... l#jls-15.7
and http://docs.oracle.com/javase/specs/jls ... ls-15.26.1

So you should group the given expression like this: b2 = (b1 != b2) rather than (b2 = b1) != b2