Introduction: Debugging Interlude—Avoiding/Finding Mistakes

Here are the prerequisites and overview for this chapter.

We'll cover the following


Learning objectives

After completing this debugging interlude, you should be able to:

  • Use programming techniques to reduce your chance of making mistakes
  • Use stubs when defining a class
  • Trace the logic of a program to help find errors in its logic
  • Thoroughly test a program


Let’s pause once again to think about debugging. The best debugging strategy is to not make any mistakes! Although we cannot expect anyone to write flawless Java code, we can adopt programming techniques that help us avoid errors. We will continue to suggest such techniques, even while we explore ways to find our own mistakes in logic. Here we will focus on mistakes associated with decision statements.

Finding mistakes in logic is accomplished during software testing. In the process, we see whether our program meets its design requirements and behaves as needed and desired. During our discussion in this interlude, we will begin to explore this area of software development.

Get hands-on with 1200+ tech skills courses.