Thursday 27 July 2017

Can we execute java application without main method ?

Can we execute  java application without main method ?

ANS----------------->



Possible with static block but not recommended to use (up to jdk1.6).

public class pd{
static {
 System.out.println("welcome in the java world");
System.exit(0);
}
}

No comments:

Post a Comment