does java support multiple inheritance code example

Example 1: how u can achieve multiple inheritances

Multiple inheritance in Java programming is achieved or 
implemented using interfaces. Java does not support multiple 
inheritance using classes.
In simple term, a class can inherit only one class and multiple 
interfaces in a java programs. In java terminology, we can say that

“A class can extend only one class but it can implement 
multiple interfaces.”

Example 2: why java don't support multiple inheritance

C++ and few other languages supports multiple
inheritance while java doesn’t support it.
  Java doesn’t allow multiple inheritance
  to avoid the ambiguity caused by it.

Example 3: how to achieve multiple inheritance in java

Multiple inheritance is achieved and
implemented using interfaces.

Example 4: reason we can implement multiple interfaces in java

A class can implement any number of interfaces.
  In this case there is no ambiguity even
  though both the interfaces are having same method.
   Because methods in an interface are always
  abstract by default, which doesn’t let them
  give their implementation 
  in interface itself.

Example 5: multiple inheritance in java

Multiple inheritance is achieved and
implemented using interfaces

Tags:

Misc Example