Compiler Error J0083

'super()' or ‘this()’ may only be called within a constructor

The compiler detected use of either the super() or this() keyword outside of a constructor. The super() keyword is used to call a superclass constructor, while the this() keyword is used to call one constructor from another. To reference methods in a base class you must use the super. keyword.

The following example illustrates this error:

public class Simple {
   
   public void method1 () {
   
      super(); // error: 'super' cannot be called
   }
}

The following example illustrates using the super. keyword to reference a method in a base class:

class NotSimple{
   public class method1(){
      //do something here
   }
}

public class Simple{
   public method2(){
      super.method1(); //correct way to call a method of a superclass
   }
}