Java Floating Point Division
Which of the following is an example of using proper floating‐point division to achieve an accurate result?
public class DivisionExample {
public static void main(String[] args) {
double chocAmount = 14.0 / 5.0;
System.out.println(chocAmount);
}
}
A
Math.pow(14, 5);
B
int chocAmount = 14 / 5;
C
Math.abs(14 / 5);
D
double chocAmount = 14.0 / 5.0;
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #2 | chunxiangxu.cxu | 1 | 1 | 0m 11s | 89 |
| #3 | lsj08030922 | 1 | 1 | 0m 22s | 78 |
| #4 | bommasam000 | 1 | 1 | 1m 24s | 16 |
| #5 | liuwilliam072410 | 1 | 1 | 2m 03s | -23 |
| #6 | zgj07310417 | 0 | 2 | 0m 41s | -61 |
| #7 | richa.tuli | 0 | 2 | 1m 08s | -88 |
Items per page:
10
1 – 7 of 7
APFIVE