pre and post increment

i++ shows that the value of i is post incremented after operation, ++i shows that its pre incremented before operation.

Example

public class Test {

	public static void main(String args[]) {
		int i = 5;

		//--------------------------------
		//--------POST INCREMENT----------
		System.out.println("5 because of post increment : " + i++);

		System.out.println("6 because value incremented above : " + i);

		// execution from left to right, this will output 6 7 8

		System.out.println(i++ + " " + i++ + " " + i++);

		// output 9
		System.out.println("output 9 : " + i);

		//--------------------------------
		//--------PRE INCREMENT----------
		System.out.println("10 because of pre increment : " + ++i);

		System.out.println("10 because same : " + i);

		// execution from left to right, this will output 10 11 12

		System.out.println(++i + " " + ++i + " " + ++i);

		// output 9
		System.out.println("output 13 : " + i);

	}
}