Compiler Error J0131

Cannot declare a method to be 'identifier' and 'identifier'

The compiler detected the use of two or more incompatible modifiers in the declaration of a method. This error usually occurs when a method has been defined with two access modifiers such as public and private. Ensure that the modifiers for the method do not conflict with each other and compile again.

The following example illustrates this error:

public class Simple {
   
   public private void method1() {
   
      // error: modifiers 'public' and 'private'
      // cannot be combined in a declaration
   }
}