What will be the answer to :
class abcd
{
public static void main(String ar[])
{
int a=2, b=3, c;
c = a++ * --b - b++ + ++a;
System.out.println(a+" "+b+" "+c);
}
}
Compiler gave the output as : 4 3 6. I got a=4 and b=3, but i was unable to solve for c. I came out with c=7.
Too much confusion in operator precedence. Someone plz help. 🙁
Operands are evaluated left to right, so your code is equivalent to:
As for the link you posted, it only says that the formula should be read as: