KnowledgeBoat Logo

Computer Applications

Predict the output of the following Java program snippet:

System.out.println(Math.rint(-9.4)+Math.sqrt(9.0));

Java

Java Math Lib Methods

35 Likes

Answer

-6.0

Working

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

23 Likes