Double.isNaN() in Java

Double.isNaN(): This method is available in java.lang.Double class of Java.

Syntax:

boolean java.lang.Double.isNaN(double v)

This method takes one argument of type double as its parameter. This method returns true if the specified number is Not-a-Number (NaN) value, false otherwise.

Parameters: One parameter is required for this method.

v: the value to be tested.

Returns: true if the value of The argument is NaN; false otherwise.

For Example:

double v = 177.9

Double.isNaN(v) = > It returns false.

Approach

Java

public class DoubleisNaN {
    public static void main(String[] args) {

        double v = 177.9;
        System.out.println(Double.isNaN(v));

    }
}

Output:

false

No comments:

Post a Comment