Programming Languages
Java
Mcq
Sep 24, 2025
What is the output of the following code?\nint x = 5;\nint y = ++x;\nSystem.out.println(x + " " + y);
Detailed Explanation
++x is pre-increment, so x is incremented to 6 first, then assigned to y. Both x and y become 6.
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts