Compiler Error 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 usually occurs when a numerical field is passed as an argument to a method but the method requires a different numerical type. To pass different numerical types to arguments of a method, typecast the field being passed to the method.

The following example 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
   }
}

The following example illustrates how to avoid this error:

public class Simple{
   public void method1(int arg1){
      //do something meaningful
   }
  
   public void method2(){
      float f = 1.0f;
      method1((int)f); //typecast the 'float' to be treated as an 'int'
   }
}