Home » Core Java » Can we override static method in Java

Can we override static method in Java

Can we override static method in Java ?
This is another tricky question Java Developers are being asked in interview room.To answer this question ,you can start with No.I am going to explain this No in points and example ,so that you will be able to easily convince your interviewer.

1. Method overriding is a Runtime polymorhism or Dynamic polymorphism feature.Overriden methods are bonded with
dynamic binding. While Static methods are bonded with static binding.
2. when a particular class having static method is loaded by class loader ,static methods are loaded.
While method overriding happens at run time and overloaded method is loaded based on method call.So static
methods are loaded into memory much before method overriding happens.

Program 1::

Output::


Leave a comment

Your email address will not be published. Required fields are marked *

1 + 13 =