Is it possible to execute a java class without main function without throwing exceptions?
The following program does J
packageorg.training.simple;
public class WithoutMain {
static {
System.out.println("This executes without main");
System.exit(0);
}
}
Output:
This executes without main
No comments:
Post a Comment