Microsoft SDK for Java

J0061-J0080

J0061 J0062 J0063
J0064 J0065 J0066
J0067 J0068 J0069
J0070 J0071 J0072
J0073 J0074 J0075
J0076 J0077 J0078
J0079 J0080  

J0061 - The members 'identifier' and 'identifier' differ in return type only

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

J0062 - Attempt to reduce the access level of member 'identifier'

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.

J0063 - Declare the class abstract, or implement abstract member 'identifier'

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
   
}

J0064 - Not used

This error message is currently not used.

J0065 - Cannot assign to this expression

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
   }
}

J0066 - 'this' can only be used in non-static methods

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
   }
}

J0067 - Cannot convert 'identifier' to 'identifier'

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
      }
   }
}

J0068 - Cannot implicitly convert 'identifier' to 'identifier'

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
   }
}

J0069 - Cannot apply '.' operator to an operand of type 'identifier'

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
   
}

J0070 - Not used

This error message is currently not used.

J0071 - Not used

This error message is currently not used.

J0072 - 'identifier' is not a member of class 'identifier'

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'
   }
}

J0073 - Not used

This error message is currently not used.

J0074 - Operator cannot be applied to 'identifier' and 'identifier' values

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
   }
}

J0075 - Invalid call

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
}

J0076 - Too many arguments for method 'identifier'

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
   }
   
}

J0077 - Not enough arguments for method 'identifier'

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
   }
}

J0078 - Class 'identifier' doesn't have a method that matches 'identifier'

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
   }
}

J0079 - Ambiguity between 'identifier' and 'identifier'

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
}

J0080 - Value for argument 'identifier' cannot be converted from 'identifier' in call to 'identifier'

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
   }
}

© 1999 Microsoft Corporation. All rights reserved. Terms of use.