(--x) Vs (- - x)
int x;x = (x=1) + (x=7)* (- - x); System.out.println( x );why does the output of the above statements differ from the one given below..int x;x = (x=1) + (x=7)* (--x); System.out.println( x );Thanks in advance....
Perhaps if you placed brackets around the expression it may help; so - -7 could become (-(-7)). What the expression is actualy doing is reversing the sign of negative seven; - -7 is actually 7. Therefore, your eaxmple - x = 1 + 7 * ( - - 7) - will return the value 56 - (8 * 7).
> I think 2007 is better then 2006.
> In 2006 everybody ask "why is this code i = i++ <do
> something>?"
> In 2007 expression is greater and stranger with ( x =
> C ) elements and --x instead of i++.
> Readers of this forum became smarter. Very good :)
You're a bit early to make that assessment, what with the year being less than one month old. The Great Influx of Zero Year schoolkids won't start for 6 months...