• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Interfaces

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can an interface extend any number of interfaces?? If yes can anyone give some examples in the JDK of such interfaces.
Thanks
Sagar
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can extends interface from interface no restriction and as many as you can.
real example from jdk is Externizable extends Serializable which i know.
Ahmad
 
Sagar Sharma
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my question was the can an interface extend 2 or more interfaces???
Pls give ur reply
Sagar
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sagar
No not at all, an interface or a class can never extend more than one interfaces or classes. As its gonna completely break the Single Inheritance rule of Java.
what do you think..please post if you need more clarification.
cheers
Nasir
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes!
Any interface can extend any number of other interfaces. This is in contrast to the linear inheritance hierarchy between classes.

[This message has been edited by Manuel Palacio (edited October 17, 2000).]
 
Sagar Sharma
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.javaprepare.com/quests/test.html
At the above URL in Q No. 43, one of the answers is (c) which means that extending from multiple interfaces is possible.
Pls have a look and comment on the same.

Sagar
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at JLS: 9.1.2 Superinterfaces and Subinterfaces

Originally posted by Sagar Sharma:
http://www.javaprepare.com/quests/test.html
At the above URL in Q No. 43, one of the answers is (c) which means that extending from multiple interfaces is possible.
Pls have a look and comment on the same.

Sagar


 
rubbery bacon. crispy tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic