Home » Java Programming » Java.lang Class

What will be the output of the program? public class SqrtExample { public static void main(String [] args) { double value = -9.0; System.out.println( Math.sqrt(value)); } }

Correct Answer: NaN

Explanation:

The sqrt() method returns NaN (not a number) when it's argument is less than zero.

← Previous Question Next Question→

More Questions from Java.lang Class

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion