According to THINKING IN JAVA,
There are two versions of each type of operator, often called the prefix and postfix versions.
For pre-increment and pre-decrement, (i.e., ++a or --a), the operation is performed and the value is produced. For post-increment and post-decrement (i.e. a++ or a--), the value is produced, then the operation is performed. As an example:
public class AutoInc {
public static void main(
String[] args) {
int i = 1;
prt("i : " + i);
prt("++i : " + ++i); // Pre-increment
prt("i++ : " + i++); // Post-increment
prt("i : " + i);
prt("--i : " + --i); // Pre-decrement
prt("i-- : " + i--); // Post-decrement
prt("i : " + i);
}
static void prt(String s) {
System.out.println(s);
}
} ///:~
The output for this program is:
i : 1
++i : 2
i++ : 2
i : 3
--i : 2
i-- : 2
i : 1
You can see that for the prefix form you get the value after the operation has been performed, but with the postfix form you get the value before the operation is performed.
Hope it helps...............
------------------
Regards,
Julia Costener