Can main() Method be overloaded or overridden

Overloading-
Any Method can be overloaded. And hence, you can overloading main() method. But JVM will always call the original main method, it will never call your overloaded main method.
Overridding-
Main is a static method and static method cannot be overridden in Java. Hence, its not possible to override main() method.

Comments

Popular posts from this blog

S.O.L.I.D. Class Design Principles

Hunt of Self Interest

Open-Closed Principle