+ 2
How main method can be overriden in java? With what purpose?
4 Réponses
+ 4
main method cant be overriden it can be overloaded. because it is a static and static methods cant be overidden.
+ 2
Caty Zurano you are wellcome
+ 1
thank you
+ 1
Static methods can't be overriden however we can declare static methods with same signature in subclass, but it is not considered overriding as there won’t be any run-time polymorphism.
If a derived class defines a static method with same signature as a static method in base class, the method in the derived class hides the method in the base class.