Lets see this practically:-
this is our program to test if we can overload java main() method or not
here i create two main methods with different parameters in same class
class A{
public static void main(String args[]){
System.out.println("first main ");
A r=new A();
A.main(25);
}
public static void main(int a){
System.out.println("second main");
}
}
Output:-
first main
second main
Yes we can have any numbers of main methods in a class method overloading.
This is because JVM always calls main() method which receives string array as arguments only.