+ 1
Explain this code?
Double r = Math.rint(9.5) + Math.rint(11.5); System.out.println(r); Why the Output is 22.0.
1 Answer
+ 6
Just by looking at it, it is rounding the numbers:
9.5 -> 10, 11.5 -> 12
10 + 12 = 22.
Double r = Math.rint(9.5) + Math.rint(11.5); System.out.println(r); Why the Output is 22.0.