• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

interface help

 
Ranch Hand
Posts: 151
MyEclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator





i just saw that interface can extends from multiple interfaces as it can implements multiple interfaces

can some one elaborate what is the difference in between both of the above sample code

means why we extends multiple or why we implements multiple
 
Ranch Hand
Posts: 227
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

akhter wahab wrote:can some one elaborate what is the difference in between both of the above sample code


You mean other than the fact that the one with 'implements' will not even compile?

An interface can only extend other interfaces. 'implements' keyword cannot be used in this case.
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried them? The difference is that the first compiles and the second doesn't.

Classes can extend classes. Interfaces can extend interfaces. Classes can implement interfaces. But you can't have an interface implement an interface.

Edit: 3 seconds late!
 
akhter wahab
Ranch Hand
Posts: 151
MyEclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:Have you tried them? The difference is that the first compiles and the second doesn't.

Classes can extend classes. Interfaces can extend interfaces. Classes can implement interfaces. But you can't have an interface implement an interface.

Edit: 3 seconds late!










then why its working

 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

akhter wahab wrote:
then why its working


Because there you have a class implementing an interface. Which is allowed, as I said.
 
akhter wahab
Ranch Hand
Posts: 151
MyEclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:

akhter wahab wrote:
then why its working


Because there you have a class implementing an interface. Which is allowed, as I said.



sorry dude every single question was just like a joke... infect i am out of mind today thanks for your patience
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic