Home > DeveloperSection > Interviews > Can we overload the main() method in java ?

Posted on    November-13-2014 6:15 AM

 Java Java 
 1 Answer(s)
  891  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    November-13-2014 7:15 AM

 Yes, we can overload the main method in java ,but we need to provide different input parameter.But JVM wil start executing the method having String[] args as parameter
For Example,

  public class OverLoadMain {
        public static void main(int [] ar) {
              System.out.println(" Overloaded Main");

        public static void main(String [] args) {
              System.out.println(" Main Methods");

Don't want to miss updates? Please click the below button!

Follow MindStick