HYBRID INHERITANCE AND IT'S EXAMPLE PART 2 IN JAVA in Hindi Lecture 86

//Hybrid Inheritance A hybrid inheritance is a combination of more than one type of inheritance. Example--- 1.Single Inheritance and Hierarchical Inheritance 2.Mutilevel Inheritance and Multiple Inheritance 3.Multilevel Inheritance and Single Inheritance //Hybrid Inheritance in Java //Single Inheritance(employee,salary) and // Hierarchical Inheritance(display1,display2) class employee { int empid; String empnm; public void enteremployee(int empid,String empnm) { this.empid=empid; this.empnm=empnm; } } class salary extends employee { int basic,hra,da; public void entersalary(int basic,int hra,int da) { this.basic=basic; this.hra=hra; this.da=da; } } class display1 extends salary { public void disp1() { System.out.println("empid="+empid); System.out.println("empnm="+empnm); System.out.println("basic="+basic); System.out.println("hra="+hra); System.out.println("da="+da); } } class display2 extends salary { int totsal; public void cal() { totsal=basic+hra+da; } public void disp2() { System.out.println("empid="+empid); System.out.println("empnm="+empnm); System.out.println("basic="+basic); System.out.println("hra="+hra); System.out.println("da="+da); System.out.println("totsal="+totsal); } } class example1 { public static void main(String args[]) { display1 obj=new display1(); obj.enteremployee(1001,"Tina Singh"); obj.entersalary(50000,7000,9000); obj.disp1(); display2 obj1=new display2(); obj1.enteremployee(1002,"Ram Singh"); obj1.entersalary(40000,8000,6000); obj1.cal(); obj1.disp2(); } }