Can we override static method in Java or what is Method Hiding in java with example
GIAN Tutorials
2:34 AM
Can we override static method in Java - which is also known as Method Hiding Can we override static method in Java No, you cannot override static method in Java because method overriding is based upon dynamic binding at runtime and static methods are bonded using static binding at compile time. Though you can declare a method with same name and method signature in the subclass which does look like you can override static method in Java but in reality that is method hiding. Java won't resolve method call at runtime and depending upon the type of Object which is used to call a static method, the corresponding method will be called. It means if you use Parent class's type to call a static method, original static will be called from a patent class, on their other hand if you use Child class's type to call a static method, the method from child class will be called. In short, you can not override static method in Java. If you use Java IDE like Eclipse or Netbeans, they wil...