Error Message | What It Usually Means |
something expected |
The parser was surprised by a symbol you wrote at or just before this point. |
cannot find symbol -- class |
Make sure that file is saved
in the same folder as the file that refers to it. |
cannot find symbol -- method |
You got the method name wrong, or you called it on the wrong file/class. |
class, interface, or enum expected |
You have too many closing braces. |
class is public, should be declared in a file named |
Your class name and file name must match exactly. |
illegal start of expression |
You're missing a closing brace for the previous method declaration. |
illegal start of type |
You wrote a statement that does not appear inside a method body. |
incompatible types -- expected type |
Make sure you understand why it found what it did, and why it expected what it did. |
missing method body |
Your method declaration line has a semicolon. |
missing return statement |
The compiler found a pathway through your non-void method that does not reach a return statement. |
non-static method cannot be referenced from a static context |
You called a method on a class name, instead of on a specific instance of that class. |
possible loss of precision |
You assigned a double value to an int variable. |
reached end of file while parsing |
You're missing a closing brace at the end of the file. |
unexpected type -- required variable |
You used = instead of ==. |
unreachable statement |
You wrote this statement after a return statement.
Remember that return statements return from the
method immediately. |
variable might not have been initialized |
The compiler found a pathway through your method where you access the value of a variable before you've assigned anything to it. |
Error Message | What It Usually Means |
My program freezes. |
You have a loop that never reaches its stopping condition. |
ArrayIndexOutOfBoundsException |
You tried to access an array element with an index that was too high or too low. |
NullPointerException |
Look for every period (.) or open bracket ([) on the
line of code that caused the error. Something immediately to the left
of one of these periods/brackets must have been the null
value (instead of being the object or array you thought you had). |
OutOfMemoryError |
You are constructing new objects inside an infinite loop. |
StackOverflowError |
You have an infinite recursion. In other words, your method calls
itself, which then calls itself, without ever stopping. |
StringIndexOutOfBoundsException |
You tried to access a character in a String with an index that was too high or too low. |