Method Overriding & Super Keyword
Method Overriding Simply,method overriding is changing the body of a method that is coming from super class to a a sub class . It occurs when the sub class has the same method as in the super class. In the " inheritance " article we could see that a method in the super class can be accessed by the sub class. But if the both classes have 2 methods with the same name? What can we do? In such instances,the method in the sub class overrides the method in the super class.That concept can be called as " Method Overriding in JAVA ". In overriding,the methods that are related to the object are executed always. Let me explain it by using the following example. When studying the above code,we can identify the class Student as the super class and the class Child as the sub class. And also,the method learn() is included in both classes. Here we have created an object called " baby " by using the sub class Child. So when we call the method learn() by using the o...