++x is called pre-increment while x++ is called post-increment.
For Example:
-- Code --
int x = 5, y = 5;
System.out.println(++x); // outputs 6
System.out.println(x); // outputs 6
System.out.println(y++); // outputs 5
System.out.println(y); // outputs 6
----------
No comments:
Post a Comment