Posts

Showing posts with the label Inheritance in java

Inheritance ,Types of Inheritance ,advantages and disadvantages of inheritance in Java

Image
Inheritance in Java: Definition :- Inheritance is the process of acquiring the properties by the sub class ( or derived class or child class) from the super class (or base class or parent class). Or The mechanism of acquiring the properties and functionalities of one class into another class is known as inheritance. What is child class? A class that inherits another class is known as child class, it is also known as derived class or subclass. What is parent class? The class that is being inherited by other class is known as parent class, super class or base class. The key word extends is used to define inheritance in Java. How to use inheri tance in Java ? The keyword used for inheritance is  extends .  Syntax of using Inheri tance in Java: syntax of using inheritance in Java is: class subclass-name extends superclass-name {       // body of the class       //methods and fields } Advantages/ Importance ...