---
title: "Can I have multiple main methods in the same class?"  
description: "Can I have multiple main methods in the same class?"  
author: "Anonymous User"  
published: 2015-07-23  
updated: 2020-09-18  
canonical: https://www.mindstick.com/interview/2724/can-i-have-multiple-main-methods-in-the-same-class  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Can I have multiple main methods in the same class?

No the program fails to compile. The compiler says that the main method is already defined in the class.

## Answers

### Answer by Anonymous User

No the program fails to compile. The compiler says that the main method is already defined in the class.


---

Original Source: https://www.mindstick.com/interview/2724/can-i-have-multiple-main-methods-in-the-same-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
