Predict the output of the following Java program snippet:
System.out.println(Math.rint(-9.4)+Math.sqrt(9.0));
31 Likes
-6.0
Math.rint(-9.4) will give -9.0 as it is nearest integer to -9.4. Math.sqrt(9.0) will give 3.0. So, output will be -9.0 + 3.0 = -6.0
Answered By
21 Likes