OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024

OOPS

Question 95
In Java, after executing the following code what are the values of x, y and z?
int x,y=10; z=12;
x=y++ + z++;
A
x=22, y=10, z=12
B
x=24, y=10, z=12
C
x=24, y=11, z=13
D
x=22, y=11, z=13
Question 95 Explanation: 
x = y++ + z++;
Post increment operator first perform the action and then it increment the value.
First perform addition of ‘y’ and ‘z’ and later increment ‘y’ and ‘z’ values
So, the value of x = 10 + 12 = 22, y = 11 and z = 13.
Correct Answer: D
Question 95 Explanation: 
x = y++ + z++;
Post increment operator first perform the action and then it increment the value.
First perform addition of ‘y’ and ‘z’ and later increment ‘y’ and ‘z’ values
So, the value of x = 10 + 12 = 22, y = 11 and z = 13.

Leave a Reply

Your email address will not be published. Required fields are marked *