Integer and Floating Point Division
What is the output of the following program?
public class DivisionTest {
public static void main(String[] args) {
double x = 7/2;
double y = 7/2.0;
System.out.println(x + " " + y);
}
}
A
3.0 3.5
B
3 3.5
C
3 3
D
3.0 3
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | zgj07310417 | 2 | 2 | 0m 49s | 151 |
| #2 | sailajavadlamani33 | 1 | 1 | 0m 00s | 100 |
| #3 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #4 | Potter16 | 1 | 1 | 0m 10s | 90 |
| #5 | lsj08030922 | 1 | 1 | 0m 38s | 62 |
| #6 | richa.tuli | 1 | 1 | 0m 42s | 58 |
| #7 | chunxiangxu.cxu | 1 | 1 | 0m 46s | 54 |
| #8 | bommasam000 | 1 | 2 | 16m 30s | -900 |
Items per page:
10
1 – 8 of 8
