IntelliJ Java IDE
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Interfaces" Watch "Interfaces" New topic
Author

Interfaces

Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
Can an interface extend any number of interfaces?? If yes can anyone give some examples in the JDK of such interfaces.
Thanks
Sagar
Ahmad Mudassir
Greenhorn

Joined: Oct 16, 2000
Posts: 10
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

Joined: Aug 31, 2000
Posts: 92
my question was the can an interface extend 2 or more interfaces???
Pls give ur reply
Sagar
Ahmed Nasir
Ranch Hand

Joined: Sep 25, 2000
Posts: 57
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
Manuel Palacio
Ranch Hand

Joined: Oct 16, 2000
Posts: 45
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).]


<a href="http://www.newinstance.net" target="_blank" rel="nofollow">http://www.newinstance.net</a>
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
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
sasuke sarutobi
Greenhorn

Joined: Oct 11, 2000
Posts: 7
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

 
 
subject: Interfaces
 
Threads others viewed
Interface
Abstarct Interface
Interface question from Khalid and Rasmussen
Will every class inherit the object class?
java.lang.Object is a class or Interface
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture