According to https://introcs.cs.princeton.edu/java/11precedence/
++ is higher priority than =
But the code below. count prints out 0 instead of 1.
I thought int count = F[0]++;
,
get the value of F[0]
++ is applied to this value 0 which becomes 1
then this increased value is assigned to count.
But it's not. To print out 1, should be int count = ++F[0];
OMG, have I misunderstood embarrassingly such extremely basic thing for a long time? This is 101 for a freshman in college question, but can someone please let me why this prints out 0 instead of 1?
int[] F = new int[26];
int count = F[0]++;
System.out.println(count); // count is 0 (instead of 1) !!!