Can main() method in Java return any data?
Can main() method in Java return any data?
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...
Please log in or register to add a comment.