File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extend an Interface (Not implement)?

 
Erap Estrada
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed in Java 6 API that the interface "Set" extends another interface "Collection".

I just thought you can't extend an interface but should be IMPLEMENTED ONLY.

Can anyone clarify this java rule?

Thanks a lot!
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Erap Estrada,

java.util.Set is also an interface and an interface can extends another interface.
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course, the Interface can extends the other interface, but we can only describe methods in each interface (Superclass interface and Subclass interface)..
 
Neha Daga
Ranch Hand
Posts: 504
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leonardo Carreira wrote:Of course, the Interface can extends the other interface, but we can only describe methods in each interface (Superclass interface and Subclass interface)..


we don't describe methods in an interface but only declare them.
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Neha, yes, its what i mean, i was wrong to use "describe" word..
sorry, perhaps it because my English language inadequacy..

Thanks..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about it for a moment. Does the second interface really implement the methods of the first? Can you instantiate the second interface?

Of course not. So the second interface doesn't implement the first, rather it extends it, but remains abstract. So it makes perfect sense that the second interface extends the first.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic