Compiler Error J0084

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

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