I am learning Java and just learned that the order in which the operations are carried out is determined by the precedence of each operator in the expression.
According to the picture above, the ++ and -- are evaluated first, but for example:
public class StudyDemo {
public static void main(String[] args) {
int a = 5;
int result = -a++;
System.out.println(result);
}
}
Why the result's output is -5
?