Can we overload main method in java?



Yes. But the main method with String args[] is called when you call the program (java OverLoadMain) Try to understand by using this simple example .
public class OverLoadMain{
         public static void main(String[] args){
                 System.out.println("Inside main method");
         }
         public static void main(String args[],String arg){
                 System.out.println("Inside overloaded method");
         }
}

Comments