int x = 7;
int y = 3;
System.out.println(x / y);What is printed?
- Acheck_circle
2
- B
2.33
- C
2.0
- D
2.333333
Explanation
When both operands are int, Java performs integer division and truncates toward zero, so 7 / 3 evaluates to 2.
AP Computer Science A· difficulty 2/5
int x = 7;
int y = 3;
System.out.println(x / y);What is printed?
2
2.33
2.0
2.333333
Explanation
When both operands are int, Java performs integer division and truncates toward zero, so 7 / 3 evaluates to 2.
Want 10 more like this — adaptive to your weak spots?