8.5 Inheritance Example in Java Multi Level

  Рет қаралды 98,028

Telusko

Telusko

Күн бұрын

Пікірлер: 12
@raghurevankar
@raghurevankar 7 жыл бұрын
Dear Naveen, Ur god of java for beginners ... Awesome teaching ...
@shashgo
@shashgo 7 жыл бұрын
Navin, I get why inheriting from multiple classes that implement their methods is not allowed. Its because the parent classes can have the same method implementations and so the compiler would not know which method to inherit. But is it possible to have multiple inheritance fro multiple abstract classes where the parent classes don't implement any of their methods? This should be like inheriting from multiple interfaces, correct? Or does the mere word "class" disallow multiple inheritance from abstract classes?
@shuvshaw9594
@shuvshaw9594 4 жыл бұрын
very helpful
@nittasandhya5413
@nittasandhya5413 6 жыл бұрын
wonderfull
@PratBais
@PratBais 5 жыл бұрын
Error class,interface or enum expected while creating 3rd class.
@pradyumnabhat3017
@pradyumnabhat3017 3 жыл бұрын
Hey there, I guess you haven't changed the object name from "AddSub" to "AddSubMull", Hope this might help.
@manjosh1990
@manjosh1990 9 жыл бұрын
Hi, I tried the same code on my computer, class AddSubMul extends AddSub, but got an error enum or interface expected. Does this mean multi-level is also not supported?
@laurynas.k
@laurynas.k 9 жыл бұрын
manjosh ramesh no, your IDE and/or your code is messed up...
@damusingh4066
@damusingh4066 8 жыл бұрын
chup be
@pradyumnabhat3017
@pradyumnabhat3017 3 жыл бұрын
Hey there, I guess you haven't changed the object name from "AddSub" to "AddSubMull", Hope this might help.
@shuvshaw9594
@shuvshaw9594 4 жыл бұрын
package javaapplication132; /* MULTI LEVEL INHERITANCE ILLUSTRATION */ public class JavaApplication132 { public static void main(String[] args) { difference obj = new difference(); // creating object of class addition obj.x=10; // assigning value of the integer obj.y=5; // assigning value of the integer obj.add(); // for addition obj.diff(); // for differnce } } class addition { int x,y, res; // declairing required variables public void add() // creating method add for the operation of addition { res= x+y; //addition operation System.out.println(res); //showing output } } class difference extends addition // now class difference is child class of additon class { public void diff() // creating method diff for the operation of difference { res=x-y; // difference operation System.out.println(res); // showing output } } class multiplication extends difference // now multiplication is child of difference class and can say grand child of addition because difference is child of addition { public void mul() //creating method mul for the operation of multiplication { res=x*y; // multiplication operation System.out.println(res); // showing output } }
@prajapatipriyanka6768
@prajapatipriyanka6768 5 жыл бұрын
Sir plzz hindi m bnaiye na vedios
8.6 Object Creation in Inheritance | Constructor | Super
6:07
8.4 Inheritance Example in Java Single Level
6:45
Telusko
Рет қаралды 120 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 84 МЛН
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 2,8 МЛН
#48 What is Inheritance in Java
8:47
Telusko
Рет қаралды 148 М.
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 544 М.
#50 Multiple Inheritance in Java
6:36
Telusko
Рет қаралды 93 М.
Using A Laptop With A FAILING Hard Drive!
8:43
Psivewri
Рет қаралды 10 М.
Never Design Again: CANVA AI Just Dropped A Huge Update!
17:40
8.21 Interface in Java Tutorial with Example
13:28
Telusko
Рет қаралды 268 М.
Java inheritance 👪
6:11
Bro Code
Рет қаралды 287 М.
Objects and References with Polymorphism (Java Tutorial)
5:04
Bill Barnum
Рет қаралды 11 М.
8.18 Abstract Class in Java Example
15:27
Telusko
Рет қаралды 383 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 84 МЛН