Error List

Error List for the ‘JAVA-Compiler’ Category

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;

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

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” );


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” );


JAVA-Compiler ,

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

try' without 'catch' or 'finally'

Applies to:
NA

Description:
A try block does not contain a catch block

Cause:
The try block is omitted.

JAVA-Compiler , ,

Variable x is already defined in this method

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);

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.

JAVA-Compiler , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Class or interface declaration expected

Applies to:
NA

Description:
This is a syntax error and occurs when keywords such as “class” or “int” are not found by the compiler or when there is code outside of a class declaration.

Cause:
a. Keywords are capitalized
b. Objects are declared at the start of the class and were mistakenly placed before the class has started.
Example:
String test = new String();
public class TestError
{
// Your code here
}


JAVA-Compiler , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,