Skip to content

Latest commit

 

History

History

08-error-handling-in-java

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Error Handling in Java

The exercises in this project are designed to help you understand error handling in Java.

Getting Started

To get started, open the project file located in error-handling-in-java/pom.xml in IntelliJ.

Project Overview

This project contains a Main class that contains several methods that demonstrate various aspects of error handling in Java. There are two other supporting classes in the project:

  1. The FakeFileReader class is a fake implementation of a file reader that is used to demonstrate how to handle exceptions in Java. You WILL NOT Need to modify this class.
  2. The CustomDivideByZeroException class is a custom exception that is thrown when a division by zero is attempted. You WILL need to modify this class.

The ExerciseTests class contains tests for the Main class.

Exercise

To complete this exercise, you will need to follow the TODO comments in the Main class and the CustomDivideByZeroException class.

Running the Tests

As always, final verification of your code should be done by running the unit tests.

To run the tests, right-click on the test/java/org.example/src/ExerciseTests class and select "Run 'ExercisesTests'". This will run all of the tests for the exercises. When a test succeeds, you will see a green checkmark next to the test. When a test fails, you will see a red X next to the test. Once all of the tests pass, you have completed the exercises.