Which among the following is not a method of Throwable class?Select one:a. public String getMessage()b. public void printStackTrace()c. public Throwable getCause()d. public Char toString()
Question
Which among the following is not a method of Throwable class?Select one:a. public String getMessage()b. public void printStackTrace()c. public Throwable getCause()d. public Char toString()
Solution
The correct answer is:
d. public Char toString()
Explanation:
The Throwable class in Java does not have a method called "public Char toString()". The correct method is "public String toString()". This method returns a short description of the throwable. The other three methods - getMessage(), printStackTrace(), and getCause() - are all valid methods of the Throwable class in Java.
Similar Questions
Which of the following should be true of the object thrown by a thrown statement?A. Should be assignable to Error typeB. Should be assignable to String typeC. Should be assignable to Exception typeD. Should be assignable to Throwable typeQuestion 6AnswerDACB
rect answer Which of the following is a super class of all exception type classes?OptionsCatchableStringRuntimeExceptionsThrowable
In Java, which keyword is used to explicitly throw an exception? Question 5Answera.Throwb.Throwsc.Exceptd.Try
Select the correct answerIn Java, the toString() method is a part of the Object class. Which of the following statements about the toString() method is correct?A. The default implementation in the Object class returns the memory address of the object.B. The toString() method is automatically invoked when an object is created.C. Overriding the toString() method is mandatory for every Java class.D. The toString() method cannot be overridden by user-defined classes.OptionsA and BOnly AC and DOnly D
Select the correct answerWhich of the following operators is used to generate instance of an exception which can be thrown using throw?Optionsallocthrownmallocnew
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.