Computer Science, asked by aniruddhaald, 6 months ago

Find the value of x:
int p=5;
int x= ++p * p++ - p;

Answers

Answered by philipvk
2

Answer:

29

Explanation:

The operator precedence in Java is as follows:

  1. postfix: expr++ expr--
  2. unary: ++expr --expr -expr
  3. multiplicative: *
  4. additive: + -

The given expression will be evaluated in the following order:

p++: increment p by 1 = 6

++p: increment p by 1 = 6

After these two increment operations p becomes 7

(6) * (6) -  7

36 - 7

29

Similar questions