exec a main class in java from a program code example
Example 1: run a java class without main method
//This is prior to Java 7
class StaticInitializationBlock{
static{
System.out.println("class without a main method");
System.exit(0);
}
}
Example 2: main class java
public static void main(String[] args) {}