Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference b/w abstract interface and Ordinary interface

 
Sathish Kumar Govindan
Greenhorn
Posts: 18
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

I want to know the difference between abstract interface and Ordinary interface.interface cannot implement anything.but i saw a code where an abstract interface implements another interface.

All interfaces are 100% abstract.then what is the need to declare abstract modifier as shown above..Please clarify my doubt..
Thanks in Advance,
G.Sathish Kumar.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no difference. The abstract keyword may be allowed in an interface declaration, but it doesn't have any effect because all interfaces are abstract anyway. Recommendation is never to use abstract in an interface declaration.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a remark.

The above interface declaration is wrong, because an interface cannot implement an another interface. It can only extends an interface which it can do multiple times.
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Interfaces are 100% abstract, that is they can NOT have implementation code, only abstract method declarations. They may define instance variables, however these must be public final and static, and i believe they are implicitly so.
While and abstract class may define both abstraact method declarations and may have implemented methods.

As was pointed out, an Interface can not implement another interface, by default an interface is abstract, this is implicit so there is no need to be stated, and if i remember the book i am studying rightly, methods in an interface are implicitly public and abstract.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic