Java Error Messages and Solutions
Pages - Menu
(Move to ...)
Home
▼
Sunday, November 30, 2008
class [ClassName] is public, should be declared in a file named [ClassName].java
›
We get error message "class [ClassName] is public, should be declared in a file named [ClassName].java" if the file name of the Ja...
3 comments:
Tuesday, November 18, 2008
Exception in thread "main" java.lang.NoSuchMethodError: main
›
'Exception in thread "main" java.lang.NoSuchMethodError: main' is a run time error message. If the main method is not prop...
is already defined
›
If we declare a variable in a method more than once than we see ' is already defined'. Find out the variable for which the message ...
reached end of file while parsing
›
The error 'reached end of file while parsing' occurs because of curly braces } problem. You have given either more or less curly bra...
1 comment:
Sunday, November 9, 2008
possible loss of precision
›
You may see the error message 'possible loss of precision' for any of the following reasons: 1) You are trying to assign a fractio...
2 comments:
integer number too large
›
We know that the maximum value of an int is 2147483647. If we write any whole number more than 2147483647 in our Java program, we may get th...
1 comment:
Tuesday, November 4, 2008
; (semi-colon) expected
›
Each java statement must ends with ; (semicolon) in Java. If we don’t put ; after any statement we will see ‘;’ expected Here is an exampl...
variable … might not have been initialized
›
We see “variable might not have been initialized” when we try to use the value of a variable before assigning any value to that variable. Ea...
missing method body, or declare abstract
›
If we put a ; (semicolon) after the method header (i.e., before starting the method body) when we are defining a concrete method (which meth...
else without if
›
Programmers may see message “else without if” when the selection (if ... else if ... else) structure is used. This may happen for any of the...
‹
›
Home
View web version