---
title: "Can we overload the main() method in java ?"  
description: "Can we overload the main() method in java ?"  
author: "Anonymous User"  
published: 2014-11-13  
updated: 2020-09-17  
canonical: https://www.mindstick.com/interview/2241/can-we-overload-the-main-method-in-java  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Can we overload the main() method in java ?

Yes, we can overload the main method in java ,but we need to provide different input parameter.But JVM wil start executing the method having String[] args as parameterFor Example,\

```
  public class OverLoadMain {         public static void main(int [] ar) {              System.out.println(" Overloaded Main");          }        public static void main(String [] args) {              System.out.println(" Main Methods");          }}
```

\

## Answers

### Answer by Anonymous User

Yes, we can overload the main method in java ,but we need to provide different input parameter.But JVM wil start executing the method having String[] args as parameterFor Example,\

```
  public class OverLoadMain {         public static void main(int [] ar) {              System.out.println(" Overloaded Main");          }        public static void main(String [] args) {              System.out.println(" Main Methods");          }}
```

\


---

Original Source: https://www.mindstick.com/interview/2241/can-we-overload-the-main-method-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
