- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Can we overload Java main method?
Yes, we can overload the main method of Java. But JVM will only call the default main method only. See the example below.
Example
public class Tester { public static void main(String args[]) { System.out.println("Default Main"); } public static void main(String args) { System.out.println("Overloaded Main"); } }
Output
Default Main
- Related Articles
- Can we overload the main method in Java?
- What is overloading? What happens if we overload a main method in java?
- Can we override the main method in java?
- Can we overload or override a static method in Java?\n
- Can we change return type of main() method in java?
- Can we declare the main () method as final in Java?
- Can We declare main() method as Non-Static in java?
- Can we create a program without a main method in Java?
- Can we execute a java program without a main method?\n
- Can we declare a main method as private in Java?\n
- Can we overload methods of an interface in Java?
- Can we Overload or Override static methods in Java?
- How can we overload a Python function?
- Can we overload a method based on different return type but same argument type and number, in java?
- Can the main method in Java return a value?

Advertisements