• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Interface

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it possible in Java for interface to use Multiple inheritance?
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mike
There is no multiple inheritance in Java. However, using interfaces you can simulate it. Interfaces let you extend multiple interfaces but not to extend multiple classes.
Put another way:
Both a class or an interface can inherit from more than one interface. A class, however, can only inherit from one other class.
Check out the following code:

hope that helps a little bit
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually it is also possible to write code where one interface extends several others. Code like this compiles at least in JDK 1.3.1
Such as
interface InterBase extends InterSuper, InterAnother {
// methods here.
}
reply
    Bookmark Topic Watch Topic
  • New Topic