Consider the following code: class PrefixPostfix { public static void main(String args[]) { int i = 10; int j = ++i; // j and i are 11 System.out.println(--i); // prints 10 } }
For the above programm why the output is 10?.Can anybody justify...?
an easy way to get the post fix and pre fix operaters is when the ++ or -- sign are on the left the variable is incremented or decremented first and then the value is printed or asigned .if the sign is on the right hand side of the variable first the variable is assigned and then it is incremented or decremented
Santosh
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
a bit of art, as a gift, the permaculture playing cards