Compiler Errors
There are two sources of errors in any program: syntax errors, and runtime errors.
-
Syntax errors occur when you omit a semicolon, misspell
println
, etc. - Runtime errors occur when you try to read past the end of an array, create an infinite loop, etc.
Whenever the Java file is saved, it gets compiled. Compiling catches all syntax errors. These appear as red marks in the left margin of the code window. Hovering your mouse over these marks gives an explanation of the error. If you click one of these marks, Eclipse will also offer suggestions to fix the error.
Runtime errors are generated when you try to run your program. These will be displayed in the console window as red text.
In both cases, a corresponding error will be displayed in the “Problems” window.
To get familiar with this feature, misspell
System.out.println()
and there will be red mark on the line.
Look for the explanation of the error/warning, and make the changes. Eclipse
will suggest corrections for most of the errors.