Error List

Error List for the ‘JAVA-Compiler’ Category

The method x declared in class y cannot override the method of the same signature declared in class z

Applies to:
NA

Description:
The method in a subclass unsuccessfully overrides a method in a superclass

Cause:
The return types are different

admin JAVA-Compiler

try' without 'catch' or 'finally'

Applies to:
NA

Description:
A try block does not contain a catch block

Cause:
The try block is omitted.

admin JAVA-Compiler

Variable x is already defined in this method

Applies to:
NA

Description:
There is more than one declaration of the same variable in the same method

Cause:
The variable is declared more than once:
public void myTest()
{
int x = 0;
System.out.println(x);
int x = 8;
System.out.println(x);
}

admin JAVA-Compiler

Variable x may not have been initialized

Applies to:
NA

Description:
A variable being accessed is not yet initialized

Cause:
An uninitialized variable is being accessed:
int x;
System.out.println(x);

admin JAVA-Compiler

Class is public, should be declared in a file named

Applies to:
NA

Description:
The source filename and class name defined in the file are not the same

Cause:
Example is the filename is Test and the class name is MyTest.

admin JAVA-Compiler

Possible loss of precision

Applies to:
NA

Description:
A variable of type double is assigned to int

Cause:
Example is:
double y = 3.14;
int x;
x = y;

admin JAVA-Compiler

Cannot find symbol - class

Applies to:
NA

Description:
The compiler does not recognize the class name you used

Cause:
a. Typographical and case issues
b. The class used is not imported
public class Input
{
public static void main( String [] args )
{
Scanner scan = new Scanner( System.in );
// code here

admin JAVA-Compiler

operator && cannot be applied to boolean

Applies to:
NA

Description:
A boolean operator is being used with an operand that does not equal to true or false

Cause:
The AND (&&) operator is used with integer or floating point operands inside an if or while statement:
int x = 2, y = 3, z = 2;
if ( x == y && z )
System.out.println( “Errorl” );


admin JAVA-Compiler

operator || cannot be applied to boolean

Applies to:
NA

Description:
A boolean operator is being used with an operand that does not equal to true or false

Cause:
The OR (||) operator is used with integer or floating point operands inside an if or while statement:
int x = 2, y = 3, z = 2;
if ( x == y || z )
System.out.println( “Errorl” );


admin JAVA-Compiler

AbstractMethodError

Applies to:
Java 2 Platform SE v1.4.2

Description:
A compiler error that is thrown when an application tries to call an abstract method.

Cause:
a. Missing bridge for final method
b. Classes are compiled without abstract methods

admin JAVA-Compiler