Microsoft SDK for Java

J0081-J0100

J0081 J0082 J0083
J0084 J0085 J0086
J0087 J0088 J0089
J0090 J0091 J0092
J0093 J0094 J0095
J0096 J0097 J0098
J0099 J0100  

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

The compiler detected a method call, but was unable to convert one of the arguments from the supplied type to the type shown in the method declaration. This error most likely occurs when a method is called with the arguments in the wrong order or the wrong method was called.

J0082 - Class 'identifier' doesn't have a constructor that matches 'identifier'

The compiler did not detect a constructor matching the call identified in the error. This error most likely occurs when a constructor is called with the wrong number of arguments. Check to make sure that the class has a constructor that matches the one you are attempting to call.

The following sample illustrates this error.

public class Simple {
   Simple(int arg1) {
      // do something meaningful
   }
   public static void main (String args[]) {
   
      Simple s = new Simple(12, 13); 
      // error: too many arguments
   }
}

J0083 - 'super( )' or 'this( )' may only be called within a constructor

The compiler detected use of either the super() or this() keyword outside of a constructor. The super() keyword is used to call a superclass constructor, while the this() keyword is used to call one constructor from another. To reference methods in a base class, you must use the super keyword.

The following sample illustrates this error.

public class Simple {
   public void method1 () {
      super(); // error: 'super' cannot be called
   }
}
public class Simple{
   public method2(){
      super.method1(); //correct way to call a method of a superclass
   }
}

J0084 - Can't return a value from a 'void' method

The compiler detected an attempt to return a value from a method declared with a return type of void.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      return 1; // error: cannot return a value
   }
}

J0085 - Expected return value of type 'identifier'

The compiler detected the keyword return within the body of a method which was declared to return a specific type, but the return had no associated value. The return statement with no associated value will not return a default value and thus must be assigned a valid return value.

The following sample illustrates this error.

public class Simple {
   
   public int method1() {
      return; // error: must return int value
   }
}

J0086 - '[]' cannot be applied to a value of type 'identifier'

The compiler detected array brackets used with a non-array variable type. Change the field to be a valid array declaration if you wish to use the field as an array.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      int i = 0;
      int j, x;
   
      x = j[i]; // error: 'j' not declared as array
   }
}

J0087 - The 'goto' statement is not currently supported by Java

The keyword goto, while defined as a keyword, has not yet been implemented in the Java language.

J0088 - Not used

This error message is not currently used.

J0089 - Already had 'case: 'identifier'

The compiler identified two or more case statements with the same identifier or value occurring within the same switch statement.

The following sample illustrates this error.

public class Simple {
   
   public int method1(int arg1) {
   
      switch (arg1) {
         case 1:
            return (int) 1;
         case 2:
            return (int) 2;
         case 2: // error: duplicate of above
            return (int) 3;
         default:
            return (int) 0;
      }
   }
}

J0090 - Already had 'default'

The compiler identified two or more instances of the keyword default occurring within the same switch statement.

The following sample illustrates this error.

public class Simple {
   
   public int method1(int arg1) {
   
      switch (arg1) {
         case 1:
            return (int) 1;
         case 2:
            return (int) 2;
         default:
            return (int) 3;
         default: // error: duplicate of previous
            return (int) 0;
      }
   }
}

J0091 - 'case' outside of switch statement

The compiler identified the keyword case used outside the scope of a switch statement.

The following sample illustrates this error.

public class Simple {
   
   public int method1() {
      case 1: // error: no switch statement
         return 1;
   }
}

J0092 - Constant expression expected

The compiler has detected an expression that used a nonconstant value when a constant value was required. This error most likely occurs when a variable is used in a case statement. Check the expression and make sure that a constant value is being used.

The following sample illustrates this error.

public class Simple{
   int var1 = 10;
   int var2 = 20;
   public void method1(){
      switch(var1){
        case var2:
        //error: cannot use variable with case
      }
   }
}

J0093 - 'break' only allowed in loops and switch statements

The compiler detected the keyword break occurring outside the scope of a loop or switch statement.

J0094 - Label 'identifier' not found

The compiler detected a label name associated with one of the keywords continue or break, but could not find the label. This error most likely occurs when a label does not exist yet is being referenced by a break or continue statement. The error can also occur if the label is placed outside of the break or continue statement's scope. A label cannot reference labels in other classes or other source files. Check to make sure the break or continue statement can access a valid label, and then compile again.

The following example illustrates this error.

public class Simple{
   public int method1(){
      int y;
      for (int x = 0; x < 10; x++){
         y = x *2;
         if (x == 5)
            break test; //error 'test' is not defined as a label
      }
      return y;
   }

The following example illustrates the proper usage of a label when used with the break or continue statements.

public class Simple{
   public int method1(){
      int y;
      for (int x = 0; x < 10; x++){
         y = x *2;
         if (x == 5)
            break test; //error 'test' is not defined as a label
      }
      test:
      return y;
   }

J0095 - 'continue' only allowed in loop

The compiler detected attempted use of the keyword continue outside the scope of a loop.

J0096 - Class value expected

The compiler detected a synchronization block, but the synchronized modifier was applied to an invalid type. This error most likely occurs when an identifier other than a class object instance is used with the synchronized statement.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      int i;
      synchronized (i);
      // error: 'i' must resolve to 
      // class or array type 
   }
}

J0097 - Class or array expected

The compiler detected the instanceof operator applied to a type that did not resolve to a class or array. The instanceof operator is used to determine if identifier is an instance of a specific class or array. Make sure the lvalue used with the instanceof operator references a class instance or array and the rvalue references a valid class name or array.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      Simple2 obj = new Simple2();
   
      if (obj instanceof int) // error: bad type
         ; // do something meaningful
   }
}
class Simple2 {
   // do something meaningful
}

J0098 - Attempt to access nonexistent member of 'identifier'

The compiler detected an array member that was specified, but could not identify it. This error most likely occurs when an attempt to reference the length method of an array is mistyped. This error can also occur when an attempt is made to call a method in an array of objects, but the call does not reference an element of the array.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int j[] = new int[10];
      int i = j.bogus; 
      // error: 'bogus' not valid member
   }
}

J0099 - Not used

This error message is currently not used.

J0100 - Cannot throw 'identifier' - the type doesn't inherit from 'Throwable'

The compiler detected an object in a throw statement that was not derived from the class Throwable. This error most likely occurs when a throw statement uses a class that does not inherit from the Throwable class. Check to make sure that the exception class you are throwing is a valid exception class.

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