0
I don't understand the postfix thing
2 ответов
+ 2
In postfix the operator comes after the operand. This form follows the Use-then-Change rule i.e it evaluates the value of the operand before the increment/decrement operation.
for eg: sum = sum + op++ ;
here it increments op by 1; evalutes to the value of op BEFORE it was incremented.
but when it comes to prefix the situation is reversed, it uses Change-then-use rule...
instead of op++ it uses ++op
where it increments op by 1 BUT evalutes to the value of op AFTER it was incremented.
Hope it was helpful.....
0
prefix means : ++x
it shows that the value of x will be first incresed by 1 and then saved it in x.
and anotherone is postfix means : x++
it shows that if we use the statement of print as like:
system.out.print(x++);
it's print current value of x and then the after the value is increased by 1.