Posts

Showing posts with the label multiple inheritance

Inheritance in Java with example

Image
Inheritance is a concept in java where new classes can be produced from existing classes. The newly created class acquires all the features of existing class from where it is derived.                     Inheritance can be implemented in java using two keywords:           1.    extends              2. implements           Producing new class from existing classes is called inheritance.              •       The newly produced class is called sub class. The original class is called super class.              •       Extends is the keyword use in inheritance. Syntax: 1 class SubClass extends SuperClass              •     Reusability is the main advantage of inheritance              •     Because of reusability developing of software/program becomes easy.              •    Sub class contains a copy of super class              •    In inheritance, we create object to only sub class. Because in sub class it contains all the methods & objects of a cl