80.6k views
2 votes
1. What will the println statement in the following program segment display? int x = 5; System.out.println(x++); a. 5 b. 6 c. 0 d. None of these

1 Answer

1 vote

Answer: a) 5

Step-by-step explanation:

x++ increases the value of x by 1 (=6), but still returns the old value (5) to the print statement

following code lines will use the new x=6 value

User RedBrogdon
by
4.9k points