I have a simple question that I cannot find the answer to in any java videos or forums. If someone can please explain it to me, why my simple post increment is not working. I start with a value of 2 and never see it increment after 1 or 30 lines.
MY CODE
int x=2;
x=x++;
System.out.println("value of x "+x);
System.out.println("value of x "+x);
System.out.println("value of x "+x);
all the answers are 2. What happened to my increment? x never got 1 added to it post the assigning. this works if I use 2 different variables and x goes up but I need to see it with one/same variable