What is method overriding in Java?
In Java, method overriding refers to when a subclass defines a method with the same name, parameter list, and return type as a method in its parent class. The subclass can override the behavior of the parent class by redefining its method.
The rules for method overriding are as follows:
- The method overridden in a subclass must have the same method name, parameter list, and return type as the method being overridden in the parent class.
 - Methods that are overridden in a subclass cannot have lower access privileges, but can have higher access privileges.
 - The method overridden in a subclass cannot throw more exceptions than the method it overrides in the parent class.
 - If a method in the parent class is declared as final or static, then the subclass cannot override that method.
 - If a method is marked as private, it cannot be overridden.
 
By using method overriding, subclasses can change the implementation details of the parent class method according to their own needs, achieving polymorphism and dynamic binding.