Posts

Showing posts from February, 2024

Object Oriented Programming - JAVA - Method Overriding - Super keyword

Image
  Object Oriented Programming - JAVA 👽 Do you know about method overriding?  Method Overriding Blog : https://miyurangika1223.blogspot.com/2024/02/object-oriented-programming-java-method.html We can't run super class method in method overriding with out special keyword "Super". Super keyword is used to call the constructor of parent class from child class and refer to the things in  the super class. Ex :     class Father{          Father() {              sout ("Father of a child" );         }    }     class Son extends Father{         Son() {             Super ();         }    }     class Test{         psvm {              Son s = new Son();         }    } The  'S' in...

Object Oriented Programming - JAVA- Method Overriding

Image
Object Oriented Programming - JAVA👽 Sometimes we have to fetch the same method name more than once. It is not possible in the programming process. But we can use method override to solve that error. So, in this blog we will discuss Method Overriding. Method overriding ... In a method inherited from a super class to a subclass, the process of changing the body is called as method overriding. So, To overriding the classes should inherit with one class to another class. Ex:   class Monkey{   void climb(){   sout ("Monkey climbs with their legs on jumping");   }    }   class Man extends Monkey{   void climb(){   sout ("Man climbs with using ladder");   }   } Here, above the subclass is the method of the superclass, and above that is the method of the subclass. That means, according to the example code,  The method of Man class is at the top The method of Monkey class is next The Man class is below the method o...