Type Casting in Division
What is printed when the following code segment is executed?
public class Main {
public static void main(String[] args) {
int a = 7;
int b = 2;
double result = a / (double) b;
System.out.println(result);
}
}
A
3.5
B
Runtime Error
C
3
D
3.0
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | ravi.palepu | 1 | 1 | 0m 00s | 100 |
| #2 | anusha.ghadge | 1 | 1 | 0m 00s | 100 |
| #3 | songqiuhui2012 | 1 | 1 | 0m 04s | 96 |
| #4 | kazvin.tjakradinata | 1 | 1 | 0m 06s | 94 |
| #5 | patrickmeijer009 | 1 | 1 | 0m 12s | 88 |
| #6 | parth.taur227 | 1 | 1 | 0m 13s | 87 |
| #7 | 7017046 | 1 | 1 | 0m 18s | 82 |
| #8 | leftoverjluck | 1 | 1 | 0m 21s | 79 |
| #9 | 108185265 | 1 | 1 | 0m 43s | 57 |
| #10 | y.seong2027 | 1 | 1 | 0m 44s | 56 |
Items per page:
10
1 – 10 of 13
APFIVE