+ 1
How can the main() function be overloaded in Java? Can you please explain me the disadvantages of doing so?
I saw this in one of the questions in Challenges
5 Réponses
+ 4
nitish kumar jha Overload main does run because it is called. Try running it.
https://code.sololearn.com/cMJttGO8jL75
+ 6
yes. The String[] version is the only entry point. Any other version has to be called.
+ 5
This code overloads main. There aren't really any disadvantages. However, I can't think of any reason for doing it either.
public class Program {
public static void main() {
System.out.println("overloaded");
}
public static void main(String[] args) {
main();
}
}
+ 3
John Wells any benefit of overloading main methods. because the overloaded main method not run....
+ 3
John Wells in this situation we can just think the overloaded main method is just as another overloaded method which named as main()...