Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Can we replace main() with static block or with other static methods?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


chandra mohan reddy
Can we replace main() with static block or with other static methods?
1 Answer(s)      3 years and 10 months ago
Posted in : Java Interview Questions


what is the use of public static void main()?can't we achieve the same thing through static block or through other static methods?


Advertisement
View Answers

February 19, 2011 at 1:21 PM


we can use static block instead of main method because static block executes before the main method this is used when a program needs two main methods we have to write second main method inside the static block



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com