Predict the output for the following Java expressions:-
(i) int a=6,b=5,c;
c=(a++ % b++)*a + ++a * b++;
(ii) a+= a++ + ++a + --a + a-- when a=7
Attachments:
Answers
Answered by
1
Answer:
a=49
Explanation:
a += a++ % b++ *a + b++* --b
=> a = a + (a++ % b++ *a + b++* --b)
=> a = 6 + (6 % 5 * 7 + 6 * 6)
// % and * will be applied first due to higher precedence
=> a = 6 + (7 + 36)
=> a = 49
Similar questions