Find the value of x:
int p=5;
int x= ++p * p++ - p;
Answers
Answered by
2
Answer:
29
Explanation:
The operator precedence in Java is as follows:
- postfix: expr++ expr--
- unary: ++expr --expr -expr
- multiplicative: *
- 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
Social Sciences,
4 months ago
English,
4 months ago
English,
8 months ago
Social Sciences,
8 months ago
Computer Science,
1 year ago