Question: What will the following program segments display? a) x = 2; y = x++; System.out.println(y); b) x = 2; System.out.println(x++); c) x = 2; System.out.println(--x);
What will the following program segments display?
a) x = 2;
y = x++;
System.out.println(y);
b) x = 2;
System.out.println(x++);
c) x = 2;
System.out.println(--x);
d) x = 8;
y = x--;
System.out.println(y);
Step by Step Solution
3.49 Rating (156 Votes )
There are 3 Steps involved in it
a 2 y x here it is post increment operator so in this case first the va... View full answer
Get step-by-step solutions from verified subject matter experts
