Posts

Showing posts from May, 2022

Comparison Between Inheritance and Polymorphism

  Introduction What is Inheritance? The ability of a class to use the properties and characteristics of another class is called as inheritance. Basically,In inheritance two types of classes are involved Superclass and subclass, Subclass : The class which uses the properties and characteristics of other class is called a subclass. Superclass : The class whose properties and characteristics are used by other classes is called a superclass. extends keyword is used in java for performing inheritance . Syntax :   class BaseClass_Name   {  //methods and fields of BaseClass }                                              class SubClass_Name extends BaseClass_Name {  //Methods and fields of SubClass } Why use inheritance ?          The most important use of inheritance i...