Java – How to check if a double value is Infinite ?

Published on March 9, 2016 by abundantcode

Filed under Java

Last modified March 9, 2016

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 1722 times

Problem Statement

You need to find out if the given number of type double is Infinite or not.


Use the isInfinite method defined in the Double class to find of the given number is a infinite as shown below.

public class Main {

    public static void main(String[] args) {

        System.out.println(" Java Tutorials");

        Double input1 = new Double(1/0.);


The output of the above program is Java Tutorials


If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment