Summary: Debugging Interlude—Common Mistakes with Classes

In this lesson, we will summarize the important points made in this chapter.

  • An error in computation that does not produce an error message is an example of a silent error.
  • Before calling a standard method in the Java Class Library, be sure to check its documentation to ensure its correct use.
  • Use simple but clear output in the early versions of a program. We can enhance the output’s appearance after the program runs correctly.
  • After declaring an object of a class type, we should create an object—or instance—of the class before using it.
  • Java will supply a default constructor for a class, if we did not define any constructors. Java will not supply a default constructor for a class if we defined at least one parameterized constructor.
  • Java will supply the method toString for a class if we do not define it ourselves. This default version likely will be unsuitable.

Get hands-on with 1200+ tech skills courses.