• Unit 4: Exceptions

    A programmer must ensure the safe execution of his or her code. In other words, if an error occurs, the program should present the user with relevant information and then quit gracefully. The built-in C++ structures used to accomplish this goal are known as "Exceptions". This unit will introduce you to the concept of throwing and catching Exceptions when something goes wrong with your software, explain how they are used in both C++ and Java, and teach you how to handle them. By the end of this unit, you will be able to write safe programs designed to perform gracefully when/if errors occur.

    Completing this unit should take you approximately 4 hours.

    • 4.1: The Role of Exceptions

      • 4.1.1: Traditional Error-Handling Methods

      • 4.1.2: Using Exceptions to Write Correct Programs

    • 4.2: Exceptions in Java and C++

        • 4.2.1: Exceptions in Java

        • 4.2.2: Exceptions in C++

      • Unit 4 Assessment