Object & Classes


  1. What is the output of this program?
    public class binary_Example
    {
    public static void main(String args[])
    {
    int n = 16;
    System.out.print(Integer.toBinaryString(n));
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    16 = 10000


  1. What is the output of this program?
    public class isNaN_Example 
    {
    public static void main(String args[])
    {
    Double num = new Double(1 / 0.);
    boolean p = num.isNaN();
    System.out.print(p);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    isisNaN() method returns true is the value being tested is a number. 1/0. is infinitely large in magnitude, which cannot be defined as a number hence false is stored in p.