In my previous articles Why Should We Follow Method Overloading Rules , I discussed about method overloading and rules we need to follow to overload a method. I have also discussed why we need to follow these rules and why some method overloading rules are necessary and others are optional. In a similar manner in this article, we will see what rules we need to follow to override a method and why we should follow these rules. Method Overriding and its Rules As discussed in Everything About Method Overloading Vs Method Overriding , every child class inherits all the inheritable behaviour from its parent class but the child class can also define its own new behaviours or override some of the inherited behaviour. Overriding means redefining a behaviour (method) again in the child class which was already defined by its parent class but to do so overriding method in the child class must follow certain rules and guidelines. With respect to the method it overrides, the overriding me...
Naresh Joshi's blog for Java Language, Spring, Hibernate, Struts, Web Services, Micro Services, Design Patterns, Multi-threading, Collection XML, SQL.