# Dans o/p

sun par

Ranch Hand

Posts: 257

Corey McGlone

Ranch Hand

Posts: 3271

posted 13 years ago

When this line executes:

i = i++ + m(i);

the operands are evaluated from left to right. First, the left hand operand is evaluated:

i = 0, so the equation becomes

i = 0 + m(i);

However, as we're using a post-increment operator, we now increment i to 1. Now we evaluate the next operand, m(i), by sending 1 to that method.

That results in the number 1 being printed, followed by a comma. Also, that method returns a 0, so our original formula evaluates to:

i = 0 + 0;

Therefore, the answer is: 1,0

I hope that helps,

Corey

i = i++ + m(i);

the operands are evaluated from left to right. First, the left hand operand is evaluated:

i = 0, so the equation becomes

i = 0 + m(i);

However, as we're using a post-increment operator, we now increment i to 1. Now we evaluate the next operand, m(i), by sending 1 to that method.

That results in the number 1 being printed, followed by a comma. Also, that method returns a 0, so our original formula evaluates to:

i = 0 + 0;

Therefore, the answer is: 1,0

I hope that helps,

Corey