Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 3.7 Exceptions

Description

All programs have bugs at some point in the development process. Bugs are ok! They show us exactly where the problems are in our code and give us helpful information so that we can fix these problems.

When there is a bug in your program, Java will actually provide helpful information about where the bug is and what kind of bug is occurring by throwing an Exception. In this lesson we’ll learn about the different kinds of exceptions and what they mean. That way, when we try running our programs and see exceptions, we’ll know how to use that information to debug our programs!


Objective

Students will be able to…

  • Explain the difference between a compile time error and a runtime error
  • Explain when exceptions are thrown
  • Explain the purpose of exceptions
  • Utilize exceptions to find and fix bugs in programs