int x = 5;
int y = ++x;
System.out.println(x + " " + y);What is printed?
- A
6 5
- B
5 6
- C
5 5
- Dcheck_circle
6 6
Explanation
Pre-increment ++x increments x to 6 first, then assigns 6 to y.
AP Computer Science A· difficulty 3/5
int x = 5;
int y = ++x;
System.out.println(x + " " + y);What is printed?
6 5
5 6
5 5
6 6
Explanation
Pre-increment ++x increments x to 6 first, then assigns 6 to y.
Want 10 more like this — adaptive to your weak spots?