Home » JAVA Programming » Object & Classes » Question
  1. What is the output of this program?
    public class isinfinite_Example
    {
    public static void main(String args[])
    {
    Double num = new Double(1 / 0.);
    boolean p = num.isInfinite();
    System.out.print(p);
    }
    }
    1. true true
    2. false false
    3. false
    4. true
    5. None of these
Correct Option: D

isInfinite() method returns true is the value being tested is infinitely large or small in magnitude. 1/0. is infinitely large in magnitude hence true is stored in p.



Your comments will be displayed only after manual approval.