• 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

Java

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is multiple inheritance allowed in java,if not then what is implimentation of more than one interface.
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No multiple inheritance is not allowed in java as in c++. Yes a class can implement more than one interfaces.
 
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

what is implimentation of more than one interface ?


Implementing an interface is not inheritance. Inheritance says "I want EVERYTHING this class has, then i'm going to add to it and change some of it. The sub-class, without doing anything other than saying "extends CLASS" is a fully functional class (without getting into abstract classes). You're saying "I want something that does everything class A does, except i need to change this one little bit.
Implementing an interface is doing nothing more than agreeing to a contract. An interface defines one or more methods that a class MUST, well, implement. When you type "implements INTERFACE", all you've done is signed the dotted line saying "I promise that somehow, my class will have these methods." Then you have to actually WRITE those methods to adhere to the contract.
 
reply
    Bookmark Topic Watch Topic
  • New Topic