filmov
tv
Java Inheritance | Java for Beginners

Показать описание
Java Inheritance | Java for Beginners
About video:
This video will explain Inheritance in Java with real life example
Links:
To learn about basics of Java click here 👇
Java class and Object Video Tutorial:
Notes:
1.What is Inheritance?
2.Syntax
3.Advantage and Disadvantage
4.Types of Inheritance
4.1 Single Inheritance
4.2 Multilevel Inheritance
4.3 Hierarchical Inheritance
1.What is Inheritance?
The meaning of "Inheritance"is to inherit i.e to receive or to get Properties (variables) and behavior (methods) of one class into another class is nothing but the Inheritance.
So basically,
Inheritance is a mechanism in which one class can inherit properties or behavior of another class.
And if we think as real life point of view
Son automatically receive or inherit properties and behaviour from his father..l
So here,class that receive or inherit properties or behaviors that class is called as Child class or Sub class or Derived class and class whose properties or behaviors we need to inherit,that class is called as Parent class or Super class or Base class
2.Syntax:
class Parent {
// Parent class body;
}
class Child extends Parent {
// Child class body;
}
3.Advantages:
1.1 Code reusability.
That means, child class can use the code that already defined in parent class and hence do not need to write it again into child class.
1.2 Inheritance also helps to reduce code redundancy.
That means, reduce the duplication of code.
Disadvantage:
In Inheritance, child class inherit properties or behaviors of parent class and hence we can say that,both parent class and child class are in inheritance relationship and hence both parent class and child class are tightly coupled and due to such coupling if any changes occur in parent class then it may affect in child class and this is the disadvantage of inheritance.
4.Types:
4.1 Single Inheritance:
In single inheritance, there is a single child class that inherit properties or behaviour from one parent class.
4.2 Multilevel Inheritance:
In multilevel inheritance,one class inherit properties or behaviour from parent class that already is a child class of another class.
4.3 Hierarchical Inheritance:
In hierarchical inheritance,
More than one child class inherit properties or behaviour
From one parent class.
For detail explanation,you can watch video tutorials.
Thank you...!
#javainheritance #inheritanceinjava #java #sgtutorial
About video:
This video will explain Inheritance in Java with real life example
Links:
To learn about basics of Java click here 👇
Java class and Object Video Tutorial:
Notes:
1.What is Inheritance?
2.Syntax
3.Advantage and Disadvantage
4.Types of Inheritance
4.1 Single Inheritance
4.2 Multilevel Inheritance
4.3 Hierarchical Inheritance
1.What is Inheritance?
The meaning of "Inheritance"is to inherit i.e to receive or to get Properties (variables) and behavior (methods) of one class into another class is nothing but the Inheritance.
So basically,
Inheritance is a mechanism in which one class can inherit properties or behavior of another class.
And if we think as real life point of view
Son automatically receive or inherit properties and behaviour from his father..l
So here,class that receive or inherit properties or behaviors that class is called as Child class or Sub class or Derived class and class whose properties or behaviors we need to inherit,that class is called as Parent class or Super class or Base class
2.Syntax:
class Parent {
// Parent class body;
}
class Child extends Parent {
// Child class body;
}
3.Advantages:
1.1 Code reusability.
That means, child class can use the code that already defined in parent class and hence do not need to write it again into child class.
1.2 Inheritance also helps to reduce code redundancy.
That means, reduce the duplication of code.
Disadvantage:
In Inheritance, child class inherit properties or behaviors of parent class and hence we can say that,both parent class and child class are in inheritance relationship and hence both parent class and child class are tightly coupled and due to such coupling if any changes occur in parent class then it may affect in child class and this is the disadvantage of inheritance.
4.Types:
4.1 Single Inheritance:
In single inheritance, there is a single child class that inherit properties or behaviour from one parent class.
4.2 Multilevel Inheritance:
In multilevel inheritance,one class inherit properties or behaviour from parent class that already is a child class of another class.
4.3 Hierarchical Inheritance:
In hierarchical inheritance,
More than one child class inherit properties or behaviour
From one parent class.
For detail explanation,you can watch video tutorials.
Thank you...!
#javainheritance #inheritanceinjava #java #sgtutorial
Комментарии