• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mutliple inheritance in Java

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am suspecting my understanding that JAVA doesn't support multiple inheritance

Consider this class

We can say that this class extends the Object class.But if I modify the above class to implement threading

seems like MyClass extending both Object class (implicitly) and Thread class (explicitly).Doesn't that means multiple-inheritance?
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one java class can not be extended from more than one superclass.

class A extends B,C is not working !!

but you can do eg:

class A implements B,C,...

seems like MyClass extending both Object class (implicitly) and Thread class (explicitly).Doesn't that means multiple-inheritance?



your class extends Thread and Thread extends Object or something else ..


http://en.wikipedia.org/wiki/Multiple_inheritance


Originally posted by narain ashwin:
I am suspecting my understanding that JAVA doesn't support multiple inheritance

Consider this class

We can say that this class extends the Object class.But if I modify the above class to implement threading

seems like MyClass extending both Object class (implicitly) and Thread class (explicitly).Doesn't that means multiple-inheritance?

 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a class cannot DIRECTLY extend more than one class. it can only have one parent. However, it can have a grand-parent, a great-grand-parent, etc.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic