Saturday, April 19, 2014

Overloading main() in Java

A common fresher interview goes like, Can we overloading main() in Java?
It's a very tricky question on the face of it. But if we just recollect basics, it won't be too hard to answer.

Answer is Yes, we can very much do.

By default we use String args[] as the method argument for main(). We can have multiple mains with different arguments types.

Error Cases
1. main(String args[]) is missing

No comments:

Post a Comment