Compiler Error 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 example illustrates this error:

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