Hi,
> public static void main( String[] args )
> {
[quoted text clipped - 4 lines]
>
> why it is printing 10 instead of 11 ??
"i++" means: first return old value, then increment i. So first you
"reassign" i to the old value of i, and then increment i or more
probably, a home- and nameless primitive integer variable that used to
be called "i" before you used that name for something else.
To do what you want, namely increment first, then return the new,
incremented value, you have to write:
public static void main( String[] args )
{
int i=10;
i = ++i;
SOP (i);
}
That should work.
Regards, Piet