• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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


 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic