answersLogoWhite

0


Best Answer

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 "Vijay";

}

}

public class B extends A {

public int getAge() {

return 24;

}

}

public class C extends B {

public String getAddress(){

return "Utter Pradesh,India";

}

}

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:

Vijay

24

Pradesh,INDIA

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

βˆ™ 12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write program java explain use abstract class multilevel inheritance?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

You want multilevel inheritance program in java?

A Scenario where one class is inheriting/extending the bahavior of another class which in turn is inheriting behavior from yet another class. Ex: public class Automobile {…} Public class Car extends Automobile {…} Public class Ferrari extends Car {…} This multilevel inheritance actually has no limitations on the number of levels it can go. So as far as java goes, it is limitless. But for maintenance and ease of use sakes it is better to keep the inheritance levels to a single digit number.


Example of multilevel inheritance program in java having HAS-A relation?

Just create a class that has two fields of object type. For example, to store data about a person, you might store a name (String object) and a birth date (Date or Calendar object).


Type of inheritance?

There are 2 Types of genetic Inheritance. 1. Polygenic inheritance, also known as quantitative or multi-factorial inheritance refers to inheritance of a phenotypic characteristic (trait) that is attributable to two or more genes and their interaction with the environment. Polygenic traits do not follow patterns of Mendelian inheritance (qualitative traits). Instead, their phenotypes typically vary along a continuous gradient depicted by a bell curve. Eye color and skin color are both polygenetic traits. 2. Monogenic inheritance is controlled by a single gene, as opposed to multigenic.


Can you explain the program of Fibonacci series in c?

You mean you have written a program, but you don't understand it? Well, how could I explain it without seeing it?


A c program to manage a bank system using inheritance and not using the concept of file handling?

using with files

Related questions

You want multilevel inheritance program in java?

A Scenario where one class is inheriting/extending the bahavior of another class which in turn is inheriting behavior from yet another class. Ex: public class Automobile {…} Public class Car extends Automobile {…} Public class Ferrari extends Car {…} This multilevel inheritance actually has no limitations on the number of levels it can go. So as far as java goes, it is limitless. But for maintenance and ease of use sakes it is better to keep the inheritance levels to a single digit number.


Example of multilevel inheritance program in java having HAS-A relation?

Just create a class that has two fields of object type. For example, to store data about a person, you might store a name (String object) and a birth date (Date or Calendar object).


Write a C program to declare result of a student using multilevel?

This is a statement with a question mark?


What is inheritance Describe its various types with the help of program?

Inheritance is a mechanism in OOP where a new class inherits properties and behaviors from an existing class. The various types of inheritance include single inheritance (one class inherits from only one class), multiple inheritance (one class inherits from multiple classes), and multilevel inheritance (one class inherits from another which in turn inherits from another). Example of single inheritance: class Parent: def __init__(self, name): self.name = name class Child(Parent): def __init__(self, name, age): super().__init__(name) self.age = age child = Child("Alice", 25) print(child.name) print(child.age)


How can you use some features of a class without inheritance?

You can create a class that does not inherit from anything and nothing inherits from it. You can then create objects from that class. This allows you to encapsulate and abstract data and methods into a simple interface to be used elsewhere in your program.


Type of inheritance?

There are 2 Types of genetic Inheritance. 1. Polygenic inheritance, also known as quantitative or multi-factorial inheritance refers to inheritance of a phenotypic characteristic (trait) that is attributable to two or more genes and their interaction with the environment. Polygenic traits do not follow patterns of Mendelian inheritance (qualitative traits). Instead, their phenotypes typically vary along a continuous gradient depicted by a bell curve. Eye color and skin color are both polygenetic traits. 2. Monogenic inheritance is controlled by a single gene, as opposed to multigenic.


Explain the concept of program and project hierarchies with examples?

explain the concepts of program and project hierarchies


Using console application show the use of inheritance in your program?

inheritance is purpose of deriving one class from other class and it is reusabilty of code..


C program to implement tower of hanoi using array implementation of stack abstract datatype?

stack abstract datatype


Short note on inheritance?

Inheritance is used object oriented program. When you create a class, you can create a child class that inherits methods and data from the parent class.


Can you explain the program of Fibonacci series in c?

You mean you have written a program, but you don't understand it? Well, how could I explain it without seeing it?


Do Abstract data type increases the complexity of program or reduces the complexity?

Decreases.