Can main() method in Java return any data?

Asked 7 years ago
Viewed 843 times

1

Can main() method in Java return any data?


1 Answer


0

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...



answered 7 years ago by Hemant Patel

Your Answer