1
visibility

What is the result of the following in Java statement?
int a=7, p=0, q=0;
p= ++a + – -a;
q -= p;
The output of q will be:

  • 13

  • 14

  • 15

  • -15

p = ++a + --a
⇒ p = 8 + 7
⇒ p = 15

q -= p
⇒ q = q - p
⇒ q = 0 - 15
⇒ q = -15