• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

acheive multiple inheritance...

Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to acheive multiple inheritance in java other than using interfaces?
I was asked this question once and answer i thought was the below one, Just tell me whatever i stated is okay or is there any other way to do this?

abstract class a {}
abstaract class b extends a {}
class concrete extends b{
should have implementation of methods available at both abstract class a and b.
Posts: 23928
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But that is *not* how multiple inheritance is defined... Multiple inheritance is the ability to inherit from many unrelated classes. Think of it as the ability to inherit implementations from two different services, from two different sources, that know nothing of each other. Obviously, if they are sub/super classes of each other, they do know something of each other.

Short answer... you can't. Java doesn't support real multiple inheritance, even with interfaces.

Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic