Beginning Java Programming: The Object-Oriented Approach Chapter 6 Catching a Thrown Exception

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to catch a thrown exception. The program throws an exception of the type ArithmeticException which is then caught on line 15.
Click “Run” to run the example in your browser or edit the code and then click “Run” to run it with your changes.
You can download the complete code for Beginning Java Programming: The Object-Oriented Approach as well to work with it in your own code editor.

This next version still catches the thrown exception on line 15 and then displays a more user-friendly error message to the user.

Return to the complete list of live code sandbox examples for Beginning Java Programming: The Object-Oriented Approach

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *