Search code examples
javastartup

Java, call a method on start


I want to call a method when my application starts. I know it's easy to accomplish on android with "oncreate", but strange enough, I can't find anything about how to accomplish this with Java not on Android.


Solution

  • Have the method be called in the main method as the first thing should accomplish this

    public static void main(String[] args){
      yourMethod();
    }