- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 the main method in Java?
Yes, we can overload the main method in Java, but When we execute the class JVM starts execution with public static void main(String[] args) method.
Example
public class Sample{ public static void main(){ System.out.println("This is the overloaded main method"); } public static void main(String args[]){ Sample obj = new Sample(); obj.main(); } }
Output
This is the overloaded main method
- Related Articles
- Can we overload Java main method?
- 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?
- Can we declare the main () method as final in Java?
- Can we change return type of main() method in java?
- Can We declare main() method as Non-Static in java?
- Can we declare a main method as private in Java?
- Can we overload methods of an interface in Java?
- Can we Overload or Override static methods in Java?
- Can we create a program without a main method in Java?
- Can we execute a java program without a main method?
- Can the main method in Java return a value?
- Can we overload a method based on different return type but same argument type and number, in java?
- How can we overload a Python function?

Advertisements