Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
Advertisements
