I know this fact that main() method is for starting point of programme which is defined by technology.But still we can do entire thing without main method any without any error. I have this code
public class WithoutMain {
int x=10;
int y=20;
void show() {
System.out.println(x);
System.out.println(y);
}
static {
WithoutMain t=new WithoutMain();
t.show();
System.exit(0);
}
}
I can write this programme without main method, so why is it necessary to have a main method?