Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 3.7 Exceptions

Description

Did you know that when a bug occurs in your program, Java helps by throwing an Exception? This exception provides valuable information about where the bug is and what kind of problem is happening. Remember, bugs are a normal part of programming and offer clues to fix issues in our code. In today’s activity, students will explore different types of exceptions and learn how they can assist in debugging. Through various exercises, students will practice identifying these errors and applying solutions, enhancing their ability to effectively debug their programs.


Objective

Students will be able to:

  • Demonstrate an understanding of syntax errors, compiler errors, run-time errors, and logic errors
  • Identify arithmetic exceptions
  • Use comments to identify errors and explain what caused it
  • Utilize exceptions to find and fix bugs in programs