J0061 | J0062 | J0063 |
J0064 | J0065 | J0066 |
J0067 | J0068 | J0069 |
J0070 | J0071 | J0072 |
J0073 | J0074 | J0075 |
J0076 | J0077 | J0078 |
J0079 | J0080 |
The compiler detected a subclass method attempting to overload a base class method, but the methods differed only in return type. In Java, overloaded methods must be distinguished by unique signatures. A unique signature consists of the method name, the number, type and positions of its parameters, and the return type.
The following sample illustrates this error.
public class Simple extends Simple2 { public void method1() { // error: only return type differs } } class Simple2 { public int method1() { return 1; } }
The compiler detected an overridden method in the class being compiled that reduces the access level of its base class method. The base class access modifier for a method must be maintained by all derived classes that want to overload the method.
The compiler detected the declaration of an abstract method within a class, but the class was not declared to be abstract.
The following sample illustrates this error.
public class Simple { public abstract void method1(); // error: class not abstract }
This error message is currently not used.
The compiler detected an expression in the position normally held by an lvalue for assignment. This error most likely occurs when an expression is being assigned a value, but the expression is not capable of accepting the assignment.
The following sample illustrates this error.
public class Simple { public void method1() { int x = 0; int y = 1; x++ = y; //error: '++' not valid } }
The compiler detected use of the keyword this within a class (or static) method. Class methods are not passed implicit this references. As such, they cannot reference instance (non-static) variables or methods.
The following sample illustrates this error.
public class Simple { int x; public static void method1() { this.x = 12; // error: 'this' instance specific } }
The compiler detected a variable type used out of its correct context. As such, the compiler could not implicitly convert the result to anything meaningful. Convert the value you are attempting to use to something the method or field definition requires, and then compile again.
The following sample illustrates this error.
public class Simple { public void method1() { int i = 10; if (i--) { // error: conditional needs expression // or boolean variable } } }
The compiler could not convert the specified variable without an explicit typecast. The error most likely occurs when a numeric field is assigned to a data type that is not numeric. Use a typecast to convert the data type to the appropriate data type, and then compile again.
The following sample illustrates this error.
public class Simple { int i = 10; public char method1() { return i; // error: expected type char } }
The compiler detected the '.' operator applied to an invalid type. This error most likely occurs when the length method is applied to an invalid type.
The following sample illustrates this error.
public class Simple { int i = 123; int j = i.length; // error: 'i' not an array }
This error message is currently not used.
This error message is currently not used.
The compiler detected a method call, but the method remains undefined. This error most likely occurs when the method name is either misspelled or cannot be found within proper scope. This error may also occur when the method does not exist. Make sure that the member you are trying to reference exists in the specified class.
The following sample illustrates this error.
public class Simple { public static void main(String args[]) { System.out.printline("Hello"); // error: 'printline' should be 'println' } }
This error message is currently not used.
The compiler detected an operator that cannot be correctly applied to the identifiers shown in the error message. This error most likely occurs when two fields are non-numeric and operators used for numbers are applied to the fields.
The following sample illustrates this error.
public class Simple { public void method1() { String s1 = "one"; String s2 = "two"; String result; result = s1 * s2; // error: invalid operands } }
The compiler detected syntax for a method call, but the identifier does not represent a valid method name. This error most likely occurs when a method name is misspelled or contains characters that are not recognized as valid in Java naming conventions.
The following sample illustrates this error.
class Simple { int x = 1(); //error: 1 is not a valid method name }
The compiler detected a known method call, but the call contained more arguments than needed. Check the number of arguments for the method you are attempting to call, and remove any additional arguments from the call.
The following sample illustrates this error.
public class Simple { public void method1(int arg1) { // do something meaningful } public void method2() { method1(1, 2); // error: Too many arguments } }
The compiler detected a known method call, but the call contained fewer arguments than needed. This error most likely occurs when one or more arguments are accidentally omitted from the call.
The following sample illustrates this error.
public class Simple { public void method1(int arg1) { // do something meaningful } public void method2() { method1(); // error: Too few arguments } }
The compiler identified a call to a known overloaded method within another class, but was unable to detect a matching method with the correct number of arguments. Make sure the overloaded method call has the correct number and type of arguments, and then compile again.
The following sample illustrates this error.
public class Simple { public void method1() { // do something meaningful } public void method1(int arg1) { // do something meaningful } } class Simple2 { public void method1() { Simple s = new Simple(); s.method1(1, 2, 3); // error: too many args } }
The compiler could not distinguish the correct method to execute. This error most likely occurs when two overloaded methods have related argument lists and the method call cannot be differentiated between the two methods. Make sure your method call is not using a parameter that conflicts with another overloaded method. Another way to avoid this error is to change the argument lists of the two overloaded methods so that they have a different number of arguments or more uniquely defined parameter data types.
The following sample illustrates this error.
public class Simple { static void method1(Simple2 s2, Simple3 s3) { // do something meaningful } static void method1(Simple3 s3, Simple2 s2) { // do something meaningful } public static void main(String args[]) { Simple2 s2 = new Simple2(); method1(s2, s2); // error: Ambiguity between Simple2 and Simple3 } } class Simple2 extends Simple3 { // do something meaningful } class Simple3 { // do something meaningful }
The compiler detected a method argument that does not match the parameters specified in the method declaration. This error most likely occurs when a numeric field is passed as an argument to a method but the method requires a different numeric type. To pass different numeric types to arguments of a method, typecast the field being passed to method.
The following sample illustrates this error.
public class Simple { public void method1(int arg1) { // do something meaningful } public void method2() { float f = 1.0f; method1(f); // error: mismatched call types } }