Compiler Error 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 usually occurs when two fields are non-numerical and operators used for numbers are applied to the fields.

The following example illustrates this error:

public class Simple {
   
   public void method1() {
   
      String s1 = "one";
      String s2 = "two";
      String result;
   
      result = s1 * s2; // error: invalid operands
   }
}