More than one main Methods in Java

By | May 18, 2015

Can you have more than one main methods in the same java class?

This is a question asked frequently in interviews .Can we do that or not.

Yes, you can have as many main methods as you like.

We can  use overloading and define different main methods with different signatures .But only that main method with exact signature as these “public static void main(String args[])” will be used as entry point by JVM.

Leave a Reply

Your email address will not be published. Required fields are marked *