ICSE Class 9 Computer Applications Question 8 of 21

Operators in Java — Question 8

Back to all questions
8
Question

Question 8

What will be the output of the following if x=5?
i. 5 * ++x
ii. 5 * x++

Answer

i.  5 * ++x
⇒ 5 * 6
⇒ 30

ii.  5 * x++
⇒ 5 * 5
⇒ 25