answersLogoWhite

0


Best Answer

Types of Inheritance:

1. Single Inheritance

A Scenario where one class is inheriting/extending the behavior of just one super class.

Ex: public class Ferrari extends Car {…}

2. Multilevel Inheritance

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.

3. Multiple Inheritance

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces.

Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…}

And this is under the assumption that Car and Automobile are interfaces.

Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.

4. Hybrid Inheritance

This is the scenario wherein your java code exhibits traits of more than one of the inheritance types explained above. Going with the example above again:

Public class FerrariF12011 extends Ferrari implements Car, Automobile {…}

The above is a combination of both single and multiple inheritance.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the different types of inheritance in java concept?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which concept in java implements the concept of reusabilityand what are it's types?

One important aspect of code reuse is related to inheritance, which is a standard part of OOP programming.


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


Need of interface in java?

Interfaces are used in Java to accomplish most of the goals of Multiple Inheritance. For several reasons, Java only supports Single Inheritance for classes - i.e. a class can have only a single parent. The use of Interfaces is how Java attempts to implement most of the positives of the concept of Multiple Inheritance while avoiding its pitfalls.


Does java support oops concept?

Yes. Java is an Object Oriented Programming Language and it supports the OOPS concepts like Inheritance, Polymorphism etc


What types of inheritance in Java programming?

Java uses a hybrid system of inheritance. The designers chose a compromise between strict single inheritance and full multiple inheritance.See the related questions section below for more information.


Specialization form of inheritance?

Inheritance refers to the concept by which the features from one class can be extended/made available in other classes. Java supports 3 forms of inheritance * Single Inheritance * Multiple Inheritance * Multilevel Inheritance (Can be implemented using interfaces)


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...


Which is the mechanism of reusing the existing class without modification?

we can use classes in java...by inheritance concept...we can reuse without modification


How multiple inheritance is done in java?

Java doesn't have multiple inheritance proper. It is possible for a class to implement different interfaces - however, in this case, only the method names are "inherited", not their contents. It is also possible to use composition instead of inheritance: an object can contain objects of different classes, and use the methods of the objects it contains - but this, too, is a different mechanism than inheritance.


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 does java not support?

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


What is ambiguity in multiple inheritance?

Java does not support multiple inheritance