Javatpoint Logo
Javatpoint Logo

JDB Exception Handling

Exception is an event that disrupts the normal flow of the program. Thus, it is important to handle these exceptions.

Like Java, Java Debugger (JDB) is also capable to handle these exceptions. The JDB catch command caught the exceptions at runtime.

Example of Exception Handling

In this example, we will handle arithmetic exception through JDB command on console.

JException.java

  • Compile the above program and create a JDB session.
  • After the execution of program the following exception occurs:
JDB Exception Handling
  • Now, catch this exception by the following command: -
  • The following message will display on your console: -

Set all java.lang.ArithmeticException

  • Continue the execution by the following command: -
JDB Exception Handling java.lang.ArithmeticException
Next Topic#




?

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA