Check out example codes for "run a java class without main method". It will help you in understanding the concepts better.

Code Example 1

//This is prior to Java 7
class StaticInitializationBlock{
   static{
      System.out.println("class without a main method");
      System.exit(0);
   }
}

Learn ReactJs, React Native from akashmittal.com