Back to Browse

Inheritance in Java - Types of Inheritance - Java in animated way

3.9K views
Sep 7, 2022
3:05

Hello Everyone, In this video we will learn about 1. What is inheritance with real life examples 2. Syntax of inheritance 3. Types of inheritance Syntax: Inheritance Example: class Employee { float salary=34534*12; } public class Executive extends Employee { float bonus=3000*6; public static void main(String args[]) { Executive obj=new Executive(); //Accessing salary variable of parent class System.out.println("Total salary credited: "+obj.salary); System.out.println("Bonus of six months: "+obj.bonus); } } Types of Inheritance: Single Inheritance: class Father { //functionality } class Child extends Father { //functionality } MultiLevel Inheritance: class Father { //functionality } class Child extends Father { //functionality } class GrandChild extends Child { //functionality } Hierarchical Inheritance: class Father { //functionality } class Child1 extends Father { //functionality } class Child2 extends Father { //functionality } Hybrid Inheritance: class Father { //functionality } class Child1 extends Father { //functionality } class Child2 extends Father { //functionality } class GrandChild extends Child1 { //functionality } Multiple Inheritance: we will learn it in coming videos #java #Inheritance

Download

1 formats

Video Formats

360pmp44.7 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Inheritance in Java - Types of Inheritance - Java in animated way | NatokHD