Exceptions

Q1:
Which four can be thrown using the throw statement?
  1. Error
  2. Event
  3. Object
  4. Throwable
  5. Exception
  6. RuntimeException

A 1, 2, 3 and 4

B 2, 3, 4 and 5

C 1, 4, 5 and 6

D 2, 4, 5 and 6

ANS:C - 1, 4, 5 and 6

The (1), (4), (5) and (6) are the only four that can be thrown. An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. The Throwable class is the superclass of all errors and exceptions in the Java language. The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch (checked exceptions) RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.