J0121 | J0122 | J0123 |
J0124 | J0125 | J0126 |
J0127 | J0128 | J0129 |
J0130 | J0131 | J0132 |
J0133 | J0134 | J0135 |
J0136 | J0137 | J0138 |
J0139 | J0140 |
The compiler encountered a serious error and could not continue processing the file reliably. Try fixing whatever errors are already flagged, and then compile again.
The compiler detected an exception that was thrown but never caught within the exception class. This error most likely occurs when a method calls another method with a declaration to throw an exception. For a method to call another method that throws an exception, the method must either be declared to throw the exception or handle the error using a try catch combination.
The following sample illustrates this error.
class SimpleException extends Exception { // do something meaningful } class Simple { void method1() throws SimpleException { } void method2() { method1(); } // error: exception not declared for method2 }
The compiler detected a class attempting to apply the keyword extends to more than one base class. This is defined as multiple inheritance in other languages and is not supported in Java.
The following sample illustrates this error.
public class Simple extends BaseClass1, BaseClass2 { // error: Multiple inheritance not supported in Java } class BaseClass1 { // do something meaningful } class BaseClass2 { // do something meaningful }
The compiler detected an operator being applied to a type it cannot be used with. Make sure the operation you are attempting is valid for the type of variable or object, and then compile again.
The following sample illustrates this error.
public class Simple { void method1(boolean b) { b++; // error: post increment operator cannot // be applied to boolean variables } }
The compiler detected a finally block but did not find a corresponding try statement. A finally block is used to execute code after a try statement and regardless of the results of the try statement.
The following sample illustrates this error.
public class Simple { public void method1() { finally { // error: missing corresponding 'try' } } }
The compiler detected a catch block but did not find a corresponding try statement. To use a catch block you must have a try statement preceding it. Make sure you have a valid try statement, and then compile again.
The following sample illustrates this error.
public class Simple { public void method1() { catch { // error: missing corresponding 'try' } } }
The compiler detected the keyword else, but did not find a corresponding if statement. This error most likely occurs when there are scoping issues with regards to the placement of an else statement. This error can also occur if an else statement's corresponding if statement is missing.
The following sample illustrates this error.
public class Simple { public void method1() { else // error: no corresponding 'if' ; } }
The compiler detected an interface declared with the keyword final. Interfaces cannot be defined as final and thus cannot use the final modifier. Remove the final keyword from the interface's declaration, and then compile again.
The following sample illustrates this error.
final interface Simple { // error: 'final' only applies to // classes, methods or variables }
The compiler detected a class declared with modifiers that cannot be combined. Make sure that the modifiers you have applied to the class do not conflict with each other, and then make appropriate changes.
The following sample illustrates this error.
public abstract final class Simple { // error: 'abstract' and 'final' cannot // be used together in a class declaration }
The compiler detected one of the keywords previously shown used in the declaration of an interface method. Because an interface method does not have implementation code, it cannot be declared as native, static, synchronized, or final.
The following sample illustrates this error.
interface Simple { public final void method1(); // error: 'method1' cannot be declared // as final in an interface }
The compiler detected the use of two or more incompatible modifiers in the declaration of a method. This error most likely occurs when a method has been defined with two access modifiers such as public and private. Make sure the modifiers for the method do not conflict with each other, and then make appropriate changes.
The following sample illustrates this error.
public class Simple { public private void method1() { // error: modifiers 'public' and 'private' // cannot be combined in a declaration } }
The compiler detected the use of two or more incompatible modifiers in the declaration of a variable. This error most likely occurs when a field has been defined with two access modifiers, such as public and private. Make sure the modifiers for the field do not conflict with each other, and then make appropriate changes.
The following sample illustrates this error.
public class Simple { public private int i; // error: modifiers 'public' and 'private' // cannot be combined in a declaration }
The compiler detected the use of one of the modifiers previously shown in the declaration of a constructor. Make sure that the constructor is not defined with any of the modifiers mentioned in the error message, and then compile again.
The following sample illustrates this error.
public class Simple { final Simple() {} // error: constructors cannot be 'final' }
The compiler detected an interface containing a constructor declaration. Because an interface cannot be instantiated, constructors are not allowed to be defined for an interface. If you are defining a method with the same name as the method, make sure that it has appropriate modifiers to differentiate it from a constructor declaration.
The following sample illustrates this error.
interface Simple { Simple(); // error: interfaces cannot // declare constructors }
The compiler detected one of the modifiers previously shown used in the declaration of an interface member variable.
The following sample illustrates this error.
interface Simple { volatile int i = 1; // error: 'volatile'cannot be used. }
The compiler detected more than one class declared with the modifier public in a source file. Remove the public access modifier from the other classes, and make sure that the class that will be exposed through the class file is declared as public. You can also move classes that need to remain declared as public to their own source file. This error can also occur if the source file does not have the same name as the public class.
The following sample illustrates this error.
public class Simple { // do something meaningful } public class Errorclass { // error: only one class may be defined as // 'public' within the same source file }
This error message is currently not used.
The compiler detected a static initializer within an interface. Because an interface does not get instantiated, initializers cannot be defined in an interface. To set the values of interface fields, initialize them at the time of declaration.
The following sample illustrates this error.
interface Simple { static { // error: static initializers cannot // be used in interfaces } }
The compiler detected an invalid label. Labels must start with an alphanumeric character. Change the label, and then compile again.
The following sample illustrates this error.
public class Simple { public void method1() { 123: // error: label cannot // begin with alphanumeric return; } }
The compiler detected an attempt to override a static method from within a subclass. A method that has been declared as static cannot be overridden.
The following sample illustrates this error.
public class Simple { static void method1() {} } class SimpleSubclass extends Simple { void method1() {} // error: cannot override // static method }