public class F {
int test(int e) {
System.out.println("ok");
return e;
}
public static void main(String[] args) {
int y = 8;
F f = new F();
int i = f.test(y++);
System.out.println(i);
}
}
the output of this program is 8
, which is what I expect.
public class Sa {
public static void main(String[] args) {
int i = 8;
i++;
System.out.println(i);
}
}
For this program, the output is 9
, which is surprising: why we are getting different values using the same values and the same increment operator in both programs?