Lets say I got this piece of code:
public class Incrementor {
private int i;
public int getInt(){
return i;
}
private void incrementA(){
i = i+1;
}
private void incrementB(){
i = i++;
}
}
- When I call
incrementA()
before callinggetInt()
the value will be 1. - When I call
incrementB()
before callinggetInt()
the value will be 0.