Methods


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    num.isNaN() method returns returns true if i is not a number and false when i is a number. Here false is returned because i is a number i:e 260.1.


  1. Which of these exceptions is thrown by compareTo() method defined in a double wrapper?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    compareTo() methods compare the specified object to be double, if it is not then ClassCastException is thrown.



  1. Which of these method of Double wrapper can be used to check whether a given value is infinite or not?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    isInfinite() methods returns true if the specified value is an infinite value otherwise it returns false.


  1. Which of these methods calls update() method?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    notifyObserver() notifies all the observers of the invoking object that it has changed by calling update(). A null is passed as the second argument to update().



  1. Which of the following methods return the value as a double?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    doubleValue()