Anatomy of a Compiler Error Message
The first line of an error message generated by the Java compiler has this format:
<fileName>:<line number>:<message>
where
- <fileName> is the name of the source file
- <line number> is the line number of the statement where the error was found
- <message> is the type of error the compiler found
The compiler also prints the line on which it identified the error, with a caret (^) indicating the place on the line where the error was generated. This sometimes can be helpful and sometimes misleading.
The Compiler Error Messages
Click on any error message below to see an explanation of the message:
class <ClassName> is public, should be declared in a file named <ClassName>.java
cannot find symbol - class
cannot find symbol - variable
'else' without 'if'
incompatible types
missing method body, or declare abstract
operator && cannot be applied to boolean,...
operator || cannot be applied to boolean,...
possible loss of precision
':' (semicolon) expected
<variable> is already defined
More error messages are coming!
Contents Copyright 2005 Julie Anderson, Capitol College
This tutor may be used freely for educational purposes. All other use is restricted by copyright.