If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in Java. In other words, If a subclass provides the specific implementation of the method that has been declared by one of its parent class, it is known as method overriding. Following are the usages of Java Method Overriding.
Rules for Java Method Overriding
Understanding the problem without method overriding
Let's understand the problem that we may face in the program if we don't use method overriding.
Problem is that I have to provide a specific implementation of run() method in subclass that is why we use method overriding.