Check whether the argument primitive double value is infinite number or not - Java Language Basics

Java examples for Language Basics:double

Description

Check whether the argument primitive double value is infinite number or not

Demo Code


public class Main {
 
  public static void main(String[] args) {
    double d = (double) 4/0;
    boolean b1 = Double.isInfinite(d);
    System.out.println(b1);//from w ww .  java2s.  co m
 
    Double dObj = new Double(d);
    boolean b2 = dObj.isInfinite();
    System.out.println(b2);
 
  }
}

Result


Related Tutorials