Summary: Debugging Interlude—the Errors Programmers Make

In this lesson, we will go over a summary of this debugging interlude.

  • A programming language, like a natural language, adheres to its own set of rules called its syntax. A programming violation of these rules is called a syntax error and is detected by the compiler. Such errors are compile-time errors.
  • The meaning of a syntactically correct Java statement is known as its semantics. A semantic error is also a logical error. Some logical errors cause a runtime error, or crash, during execution, while other logical errors just produce incorrect results.
  • Some examples of errors that the compiler can detect are
    • Missing or extra semicolons
    • Spelling or capitalization mistakes
    • Missing parentheses or braces
    • Mismatched parentheses or braces
    • Missing operators
    • Missing or extra quotes
    • Uninitialized Variables
  • Finding a logical error in a program can be more difficult than correcting a syntactical error. Tracing a program’s execution by hand or by adding temporary print statements that display intermediate results will help us find these errors.

Get hands-on with 1200+ tech skills courses.