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

@Overrride annotation introduced in Java1.5

Liskov Substitution Principle (LSP)

Marie Choco Lava