Very valid question!
Your code doesn't work since result--
is performed only after the substitution =
. Your code would work had you used prefix operator:
result = --result;
However that doesn't make any sense as you can simply write:
--result;
For a more thorough explanation see this question/answers on how prefix/postfix operators work on Java.