Can main() method in Java return any data?

Asked 20-Dec-2017
Viewed 780 times

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