core java |video 6|English

Опубликовано: 14 Июль 2026
на канале: variety track
84
2

#corejava #java #javatamil #selenium #javaprogramming #cucumber
#inheritance
INHERITANCE:
??We can access one class property (method) into another class using 'extend' keyword
Without creating multiple object
Advantages
*Object creation gets reduced
*Memory wastage is reduced
*reusable code purpose


Type of inheritance
------------------------
1. Single Inheritance
2. Multilevel Inheritance
3. Multiple Inheritances
4. Hybrid Inheritance
5. Hierarchical Inheritance

1. Single Inheritance
---------------------------------
??One parent class is directly support into one child class using extend keyword


2. Multiple Inheritance
---------------------------
More than one parent going to support a single Child parallely at a time.

Multiple inheritance won’t work in java,due to priority problem,syntax error and it shows compile time error

1.Syntax error: By using extends keyword we cannot extends more than one class
2.Priority issue: Whether the parent classes having the same method means child class will get confused-to give the priority for which parent class method

We can achive multiple inheritance by using Interface


Child extends parent1,parent2--?not possible


3. Multilevel Inheritance
--------------------------------------
One child class and more than one parent class




4.Hierarchical Inheritance
---------------------------
??One parent class and more than one child class


5.Hybrid Inheritance
-------------------------
Combination of any two inheritance