Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

abstract interface vs interface in Java?

 
Greenhorn
Posts: 10
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi


Anyone please clarify the difference between absract interface and interface?

i observed that both declerations are same.

abstact interface and interface might be same?

Thanks in Advance.

Kishore Nallamothu

 
Marshal
Posts: 75648
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's an abstract interface? I have never heard of it.
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kishore,

I guess you're mixing up here some slightly different things. Don't confuse interface in general software design and interfaces in the sense of the Java keyword "interface". Although they are related you have to be careful what exactly articles or papers on the internet talk about!

In Java there's no distinction between interface and abstract interface, as Campbell already pointed out. Every JAVA interface is implicitly abstract (meaning the keywords "interface" and "abstract").

In the broader sense of software design interfaces are usually an abstract concept for something, too. So the abstract is also redundant here.

If you don't have any specific piece of information I'd say interface and abstract interface are the same because an interface is implicitly abstract. I hope this answers your question.

Marco
 
Ranch Hand
Posts: 449
Scala IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishore Nallamothu wrote:Anyone please clarify the difference between absract interface and interface?


As per JLS

Every interface is implicitly abstract. This modifier is obsolete and should not be used in new programs.

 
Ranch Hand
Posts: 529
19
Eclipse IDE MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are the non-access modifiers an interface(Outer) can have
  • strictfp
  • abstract (Not recommended)
  • If use this abstract non-access modifier compiler will not give error and you can run it successfully BUT
    As

    Marco Ehrentreich wrote:Every JAVA interface is implicitly abstract

    and

    Muhammad Khojaye wrote:JLS says: Every interface is implicitly abstract. This modifier is obsolete and should not be used in new programs.

    It is fruitless to use abstract keyword with an interface because use of abstract is to make a class or method abstract which can be non- abstract(may have body defined) but here an interface is already abstract so you don't have to use abstract keyword.
    This is the same case with access modifiers of methods(though it is abstract, static and default last two since 1.8 and later) in an interface which are declared public implicitly so you don't have to declare it with public keyword. So there is no difference, if you want to use abstract keyword before an interface ignoring what JLS rule says else If want to follow JLS then say as

    Campbell Ritchie wrote:What's an abstract interface? I have never heard of it.


    These are the non-access modifiers an interface(inner in nested interface) can have
  • strictfp
  • abstract (Not recommended, as above said)
  • static (I don't know its use or recommended or not but you can use static keyword for an interface which is in another interface)
  •  
    What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
    Free, earth friendly heat - from the CodeRanch trailboss
    https://www.kickstarter.com/projects/paulwheaton/free-heat
    reply
      Bookmark Topic Watch Topic
    • New Topic