What is the difference between these two snippets of code? I know that the ++ sign in java increases the value by 1, in this case it is 4, The first one does not print anything but the second one does print the value of 5. Why?
int val = 4;
if (val++ == 5)
System.out.println(val);
And this one
int val = 4;
if (val++ == 5)
System.out.println(val);
System.out.println(val);