What will be the output of the given Java square root related code snippet?

 

public class Example 
{
    public static void main(String [] args) 
    {
        double value = -7.0;
        System.out.println( Math.sqrt(value));
    }
}


The answer will be : NaN
The sqrt() method returns NaN (not a number) when its argument is less than zero.

 


Related #tags:     #java     #core-java    

Related questions




Looking for change? Click below to prepare for technical interview.


Technical Interview Questions