Compiler Error J0068

Cannot implicitly convert 'type' to 'type'

The compiler could not convert the specified variable without an explicit typecast. This error usually occurs when a numerical field is assigned to a data type that is not numerical. Use a typecast to convert the data type to the appropriate data type and compile again.

The following example illustrates this error:

public class Simple {
   
   int i = 10;
   
   public void method1() {
      char c = i; // error: expected type char
      char c = (char)i; // this is the correct assignment statement
   }
}