Double.isFinite() in Java

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

Syntax:

boolean java.lang.Double.isFinite(double d)

This method takes one argument of type double. This method returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

Parameters: One parameter is required for this method.

d: the double value to be tested.

Returns: true if the argument is a finite floating-point value, false otherwise.

For Example:

double d = 199191.198

Double.isFinite(d) = > It returns true.

Approach

Java

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

        double d = 199191.198;
        System.out.println(Double.isFinite(d));

    }
}

Output:

true

No comments:

Post a Comment