• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface implements interface?

 
jaspreet atwal
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I am overlooking a very basic concept here... Why can't we have an Interface that implements an Interface? Or is it that Interfaces should always be top level, there cannot be an Interface somewhere in between a hierarchy tree?

 
Deepa Neela
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
interface extends another interface but not implements it, because interface will not contain the implementation (you cannot provide implementation in the interface). So you can just extend it but not implement it.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implements denotes defining an implementation for the methods of an interface. However interfaces have no implementation so that's not possible. An interface can however extend another interface, which means it can add more methods and inherit its type.
 
jaspreet atwal
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garret and Deepa,
Thank you!! That answers my question.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Deepa",
Please check your private messages regarding an important administrative matter.
-Ben
[ May 06, 2008: Message edited by: Ben Souther ]
 
Mayu Mayooresan
Ranch Hand
Posts: 37
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my understanding.....

When you implement an Interface to a class you must re-declare all the class and fill them up. Which is not possible in Interface as Interfaces are abstract. So You can't implement an interface to another interface but you can happily extend.

Correct me if my perception is wrong.

Thanks.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic