answersLogoWhite

0

Multilevel inheritance is a java feature where the properties of a class are inherited by a class which extends one or more classes which extend its features...

Example:

public class A {

public String getName(){

return "Rocky";

}

}

public class B extends A {

public int getAge() {

return 24;

}

}

public class C extends B {

public String getAddress(){

return "North Carolina, USA";

}

}

public class D extends C {

public void print {

System.out.println(getName());

System.out.println(getAge());

System.out.println(getAddress());

}

}

This method would print the following in the console:

Rocky

24

North Carolina, USA

Here in class D you are calling methods that are available inside classes A, B & C. Though D extends only class C, it would in turn inherit the properties of the classes extended by C and its parents.

This is multi level inheritance.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What are the names of different part of simple java program?

NO!


What is inheritance in core java?

Inheritance is the ability to derive and use other class's attribute and behavior. It results in the reduction of coding lines and the reuse of same codings in some other places. It is an important concept for java and makes to program easily...


What does java not support?

Java does not support multiple inheritance.......


How can you write multiple inheritance program in java?

Java does not support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }


What is ambiguity in multiple inheritance?

Java does not support multiple inheritance


What kind of inheritance is not allowed in java?

Java does not allow the multiple inheritance of concrete classes, though it does allow a "hybrid" inheritance of one concrete class and multiple interfaces.


What is problem in multiple inheritance?

Java does not support direct multiple Inheritance. Harder to implement, not every language support it: C++ does, Java does not.


Give the structure of multiple inheritance?

Java does not support multiple inheritance. It is done with the help of interfaces in java. a class can implement n number of interfaces, thus showing multiple inheritance. but a class cannot extend multiple classes in java.


What is public inheritance in java?

Inheritance is a Java feature by which we can reuse code and programming logic from one class in another class. We implement Inheritance using the extends keyword.Ex: public class Ferrari extends Car {…}Here the Ferrari Class will extend features from the Car Class.This is Inheritance. The different types of Inheritance are:Single InheritanceMulti-Level InheritanceMultiple Inheritance (Java supports only Partial Multiple Inheritance) andHybrid Inheritance


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


How ploymorphism and inheritance is different from that in Java and c plus plus?

C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.


What is a Java Drive-By?

AnswerA Java Drive-By is a Java Applet that is coded in Java and is put on a website. Once you click "Run" on the pop-up, it will download a program off the internet. This program can be a virus or even a simple downloader. If you'd like to get the source code or wanna know more information about a Java Drive-By, use Google.