J0041 | J0042 | J0043 |
J0044 | J0045 | J0046 |
J0047 | J0048 | J0049 |
J0050 | J0051 | J0052 |
J0053 | J0054 | J0055 |
J0056 | J0057 | J0058 |
J0059 | J0060 |
The compiler detected a modifier used twice in a declaration. This error most likely occurs when the same modifier is mistakenly used more than once within a declaration.
The following sample illustrates this error.
public class Simple { public public void method1() { // error: 'public' used twice // do something meaningful } }
The compiler detected an interface declaration using the implements keyword. Interfaces cannot implement other interfaces. Interfaces may only be implemented by classes.
The following sample illustrates this error.
public interface Simple implements color{ // error: 'Simple' cannot implement the // 'color' interface } interface color { // do something meaningful }
The compiler detected the same identifier name being declared more than once within the same scope. This error most likely occurs when a variable is mistakenly declared more than once.
The following sample illustrates this error.
public class Simple { private int i; private int i; // error: 'i' declared twice }
The compiler could not locate the definition for the specified class. This error is most likely caused by a typographical error. It may also occur when the package containing the specified class cannot be found.
The following sample illustrates this error.
public class Simple { char buf[] = new chaar[5]; // error: 'chaar' not a valid type }
The compiler detected one of the following conditions:
Make sure that the package exists and that any classes that you import exist in the package specified in the import statement, and then compile again.
The following sample illustrates this error.
package non.existent; import non.existent; // error: public class Simple { // do something meaningful }
The compiler detected that the identifier referred to by the keyword implements is not an interface.
The following sample illustrates this error.
class Simple2 { // do something meaningful } public class Simple implements Simple2 { // error: cannot implement class 'Simple2' }
The compiler detected an invalid package name. This error most likely occurs when a syntactical error exists in an import statement or when the package name does not otherwise exist.
The compiler detected an attempt to subclass a class declared with the keyword final. Classes declared as final cannot be subclassed.
The following sample illustrates this error.
final class Simple2 { // do something meaningful } public class Simple extends Simple2 { // error: cannot extend 'Simple2' }
The compiler detected an unknown class name while processing an import statement. This error most likely occurs when the identifier is misspelled or does not exist. This error may also occur if the CLASSPATH environment variable is not set correctly.
The following sample illustrates this error.
import java.io.bogus; // error: unknown class name public class Simple { // do something meaningful }
The compiler detected a reference to an identifier that is not a member of the specified package. This error most likely occurs when the identifier is misspelled or does not exist.
The following sample illustrates this error.
class Simple2{ public void methodx(){} } public class Simple { public void method1() { Simple2 smp = new Simple2(); smp.method2(); // error: 'method2' not member of 'Simple2' } }
The compiler detected a package name, but was unable to locate the package definition. This error most likely occurs when a syntactical error exists in an import statement. This error may also occur when the package cannot be found or does not exist. Make sure the path is set in the CLASSPATH environment variable.
The following sample illustrates this error.
import java.lang.String.*; // error: 'String' not a valid package name public class Simple { // do something meaningful }
This error message is currently not used.
The compiler could not resolve an ambiguity between the two identifiers shown. The error most likely occurs when the same class name occurs in two packages that are both imported into a source file using the "*" class import specifier. Make sure that you do not have two classes with the same name in the packages you are importing into your source file.
This error message is currently not used.
This error message is currently not used.
The compiler detected a method declaration without a return type specified. All method declarations must specify a return type. If the method is not meant to return a value, use the void keyword.
The following sample illustrates this error.
public class Simple { public method1() { // error: no return type // do something meaningful } }
The compiler did not detect the class name previously shown within the specified file. This error most likely occurs when the class name is either misspelled or does not exist. This error may also occur when a .class file has been renamed after successful compilation.
The compiler detected a variable declared as type void. The keyword void is not allowed in variable declarations. Rather, void can only be used as a method return type, indicating that the method does not actually return a value.
The following sample illustrates this error.
public interface Simple { public final static void i = 1; // error: 'void' not valid }
The compiler detected an attempt to reference a variable without a known object association. This error most likely occurs when an instance field or method (a field or method declared without the keyword static) is referenced from within a static method without a valid instance. Static methods cannot use instance fields and methods without a valid instance of the class.
The following sample illustrates this error.
public class Simple { private int x; public static void method1() { x = 0; // error: 'x' must be static } }
The compiler detected an attempt to initialize a variable with another variable that had not yet been defined. To avoid this situation, reverse the field declarations order so that a variable that is referenced by another is defined first.
The following sample illustrates this error.
public class Simple { private static int i = j; // error: 'j' not yet defined private static int j = 0; }