Answers for "nan in java"

3

how to return nan in java

public class NaN
{
    public static void main(String[]args)
    {
        System.out.println(0.0 / 0.0);	  //zero divided by zero
        System.out.println(Math.sqrt(-1)); //take sqrt of negative number
        System.out.println(10.0 % 0);      //taking mod by zero
    }
}
Posted by: Guest on September-06-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language