Question : pre increment and post increments
Answered by : fancy-frog-dwkn6gkdyapn
int x =0;
// POST increments: increments after it prints x or stmt
System.out.println("Hello World"+ x++); // 0
System.out.println("Hello World"+ x); // 1
// PRE increments: increments before it prints x or stmt
System.out.println("Hello World"+ ++x); // 1
System.out.println("Hello World"+ x); // 1
Source : | Last Update : Mon, 28 Mar 22
Question : pre increment and post increment
Answered by : abid-mbudisor1clu
Pre-increment (++i) − Before assigning the value to the variable, the value is
incremented by one.
Post-increment (i++) − After assigning the value to the variable, the value is
incremented.
Source : | Last Update : Sun, 13 Feb 22