Consider the below Java program.
Hi Geek (from main) Hi, Geek Hi, Dear Geek, My Geek
The main method in Java is no extra-terrestrial method. Apart from the fact that main() is just like any other method & can be overloaded in a similar manner, JVM always looks for the method signature to launch the program.
- The normal main method acts as an entry point for the JVM to start the execution of program.
- We can overload the main method in Java. But the program doesn’t execute the overloaded main method when we run your program, we need to call the overloaded main method from the actual main method only.
This article is contributed by Himanshi Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Does JVM create object of Main class (the class with main())?
- Valid variants of main() in Java
- Main thread in Java
- Replacing 'public' with 'private' in "main" in Java
- Static Block and main() method in Java
- Execute main() multiple times without using any other function or condition or recursion in Java
- Understanding public static void main(String args) in Java
- How to overload and override main method in Java
- What are the main differences between the Java platform and other platforms?
- In Java, Can we call the main() method of a class from another class?
- Understanding "static" in "public static void main" in Java
- Is main method compulsory in Java?
- Java Program to Print any Statement without Using the Main Method
- Method overloading and null error in Java
- Overloading in Java
- Different ways of Method Overloading in Java
- Method Overloading and Ambiguity in Varargs in Java
- Constructor Overloading in Java
- Method Overloading with Autoboxing and Widening in Java
- Java Function/Constructor Overloading Puzzle