Skip to main contentSkip to solution

Arrange the following steps of handling exceptions:

A. An error encountered in a method

B. Create exception object and exception is raised

C. Runtime system searches for exception handler in the current method

D. Catching an exception

Solution

✅ Correct Option: 2

A. An error encountered in a method

B. Create exception object and exception is raised

C. Runtime system searches for exception handler in the current method

D. Catching an exception

The error occurs first, the method creates and throws an exception object, the runtime then searches for a handler (starting with the current method), and the handler finally catches it.


Option 1: the runtime can search for a handler only after the exception object has been created and thrown, so B comes before C.

Option 3: an exception object cannot be created before an error has occurred, so A comes first.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question