---
title: "Can main() method in Java return any data?"  
description: "Can main() method in Java return any data?"  
author: "Kavya Dubey"  
published: 2017-12-20  
canonical: https://answers.mindstick.com/qa/31861/can-main-method-in-java-return-any-data  
category: "technology"  
tags: ["java programming"]  
reading_time: 1 minute  

---

# Can main() method in Java return any data?

Can main() [method](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) in [Java](https://www.mindstick.com/articles/1702/introduction-to-java) return any data?

## Answers

### Answer by Hemant Patel

No, **main()** method in Java can't return any data that's why it's declared with a **void** return type. *The compiler would not compile it as it is expecting* the return type of main to be int, hence we can overload it.

Well, for your knowledge Main () Method is validated only when its return type is Void. Any other substitute is not adequate.

***Hope it's informative...***\

\

\


---

Original Source: https://answers.mindstick.com/qa/31861/can-main-method-in-java-return-any-data

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
