

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Error Message “Possible” Cause Cannot find symbol — class Your file is not saved in the same folder as the file that refers to it. Cannot find symbol — method The method name is wrong and/or it is nonexistent Cannot find symbol — variable You are using an undeclared variable or variable name is misspelled Class, interface, or enum expected Too many closing braces } Illegal start of expression Missing closing braces } for a method or extra parentheses () Reached end of file while parsing Missing closing braces } at end of file ??> expected Missing ??> at area of line number Class is public, should be declared in a file… Class name does’t match the saved filed name (case sensitive!) Incompatible types — expected type Your types are not matching up with what’s given and what’s expected Missing method body Method declaration line has a semicolon ; Missing return statement There’s a path with no return value Unreachable statement (^) There’s code written after a return statement. Variable might not have been initialized A variable you are using might not have an assigned value. Unexpected type — required variable You used = instead of == Unclosed string literal Missing “” around a string
Common Runtime Errors:
Caveats With Error Messages:
JGrasp Debugger
Error Message “Possible” Cause No error message! My program appears to be frozen! You have an infinite loop somewhere StringIndexOutOfBoundsException You’re accessing a character in a String with an index that is nonexistent ArrayIndexOutOfBoundsException You’re accessing an array element with an index that is nonexistent NullPointerException You’re accessing a null value (check every period. or open bracket [ on line of error) InputMismatchException (^) Your Scanner is reading the wrong type NoSuchElementException You’re reading past the end of a Scanner