Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1062 :

Posted: Wed Apr 09, 2014 3:21 pm
by JeramieH

Code: Select all

int i4 = i1 + (i2=i3);

First the value of i1 is evaluated (i.e. 1). Now, i2 is assigned the value of i3 ...
Why isn't (i2=i3) evaluated first due to the parantheses, and how do you know when it is or isn't first?

Re: About Question enthuware.ocajp.i.v7.2.1062 :

Posted: Wed Apr 09, 2014 8:40 pm
by admin
If you want to understand this thoroughly, you should go through this: http://docs.oracle.com/javase/specs/jls ... l#jls-15.7

HTH,
Paul.