Menu Bar

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, 30 September 2016

Java Program Without Main Method ?

Previously we have discussed the Program for 


This is most important interview question ,That Java Program can run without main method or not ? The answer is Yes Program can run without main Method using static Block. Static Block run before Constructor calling.And to run Static Block we do not need to create any Object.

public class WithoutMainMethod {
 
static{
System.out.println("** INSIDE STATIC BLOCK **");
}
public static void main(String[] args) {
 
}
}


Program Output :-

** INSIDE STATIC BLOCK **






Share this Blog with yours Friends !!

No comments:

Post a Comment