When we are writing Java programs, the compiler is our first line of defense against errors. It can catch syntax errors.
Syntax errors represent grammar errors in the use of the programming language. They are the easiest to find and correct. The compiler will tell you where it got into trouble, and its best guess as to what you did wrong.
Some common syntax errors are:
), square bracket
], or curly brace
Here’s an example of a syntax error message:
Usually the error is on the exact line indicated by the compiler, or the line just before it; however, if the problem is incorrectly nested braces, the actual error may be at the beginning of the nested block.
Try compiling the code and find the syntax error in Debug.java.