int x = 5;
double y = 2.0;
System.out.println(x / y);What is printed?
- Acheck_circle
2.5
- B
2
- C
2.0
- D
3
Explanation
When one operand is a double, the other int is promoted to double; 5 / 2.0 yields 2.5.
AP Computer Science A· difficulty 3/5
int x = 5;
double y = 2.0;
System.out.println(x / y);What is printed?
2.5
2
2.0
3
Explanation
When one operand is a double, the other int is promoted to double; 5 / 2.0 yields 2.5.
Want 10 more like this — adaptive to your weak spots?