Methods
- 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);
}
}
-
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.
- Which of these exceptions is thrown by compareTo() method defined in a double wrapper?
-
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.
- Which of these method of Double wrapper can be used to check whether a given value is infinite or not?
-
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.
- Which of these methods calls update() method?
-
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().
- Which of the following methods return the value as a double?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
doubleValue()