TABLE 2 . 1
Operators in Java, in Descending Order of Precedence
Category Operators
Unary
++ -- + - ! ~
(type)
Arithmetic
* / %
+ -
Shift
<< >> >>>
Comparison
< <= > >= instanceof
== !=
Bitwise
& ^ |
Short-circuit
&& ||
Conditional
?:
Assignment
=
op=
Mr Sandeep and Sybex both say that ++ operator has a higher precedence than = ,
But What i think is
1)++ has a higher precedence than = //True
i agree fully to this,no compromise.(Sybex Complete
Java Certification says that)
2)prefix ++ has a higher precedence than = //True
no doubts on that too(a=++i) ; so no problem here.
3)postfix ++ has a higher precedence than = //True according to Mr Sandeep
//
But False According To Me(i=j++) ;
here first i is assigned the value of j,and then j is incremented.
I know i might be wrong,but it goes like this,
Comments Requested To Clear The Doubts.
Thanks,
Anand
[ September 16, 2005: Message edited by: anand phulwani ]