jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Difference b/w abstract interface and Ordinary interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference b/w abstract interface and Ordinary interface" Watch "Difference b/w abstract interface and Ordinary interface" New topic

Difference b/w abstract interface and Ordinary interface

Sathish Kumar Govindan

Joined: Jan 23, 2007
Posts: 18

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.

Certified on SCJP 5.0, OCPJWCD, Spring3.2, OCEJWSD
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Not an advanced question. Moving...

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
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.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
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.

Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Gavin Tranter
Ranch Hand

Joined: Jan 01, 2007
Posts: 333
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Difference b/w abstract interface and Ordinary interface
It's not a secret anymore!