so im currently working my way becoming a java developer, im starting with testing the basic stuff and when i was testing the post increment operator i stumbled upon some unexpected result.
The code goes like this:
public static void main(String[] args) {
int intVar1 = 10;
int intVar2 = 20;
short shortSum = (short) (intVar1 + intVar2);
short shortSum2 = shortSum++;
System.out.println(shortSum);
System.out.println(shortSum2);
}
The result displayed in the terminal is:
31 30
Question is, shouldnt it display the values the other way around? Shouldnt the shortSum variable be 30 and shortSum2 be 31?