In this example we will show you how to run an application with no main method in Java.
Source Code
ppackage com.beginner.examples;
public class NoMain {
// run with no main method
static {
System.out.println("OK!");
System.exit(0);
}
}
Output:
OK!