Running Java without Main method

StaticBlockClass.java
~~~~~~~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public  class StaticBlockClass {

      static{
            System.out.println("i dont have main method");
      }
     
}

TestStaticClient.java
~~~~~~~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public class TestStaticClient {

      public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
            Class.forName("com.anil.builder.design.pattern.StaticBlockClass");
      }
}

No comments:

Post a Comment