ok so in java the a--, first evaluates the a then it applies the operation (in this case subtraction),
for example:
a=3;
b=a--;
'b' will take the initial value of 'a' (b=3) and 'a' will then decrement (a=2).
In the following example:
int a=3;
int b;
b= a-- * a--;
System.out.println("a = " + a);
System.out.println("b = " + b);
1. b=current value of a (3)
2. a=a-1 (2)
3. b=b * current value of a (b = 3 * 2)
4. a=a-1 (1)
And our result will be:
b=6 a=1
for --a, java first applies the operation then it takes the value;
for example:
a=3;
b=--a;
'a' will decrement (a=2) and then 'b' will take the value of 'a' (b=2).
Example:
int a=3;
int b;
b= --a * --a;
System.out.println("a = " + a);
System.out.println("b = " + b);
1. a=a-1 (2)
2. b=value of a (2)
3. a=a-1 (1)
3. b=b * value of a (b = 2 * 1)
And our result will be:
b=2 a=1
hope this helps. good luck have fun :)