• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why should use Interface

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ponnusamy,

Actually if we want the subclasses should follow some standards, we can go for interface / abstract.

But in the subclasses, we need to give our own implementation to the interface method. Instead of doing this, we can declare a local method in the class itself.
Here what is the real use of interface.

But in abstract, we can give some default behaviour. But in interface we cant give the default behaviour too.

Please explain the interface concept. How it helps in loose coupling.

Thanks.
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take look at this https://coderanch.com/t/547096/java/java/Interfaces-vs-classes#2483457
 
reply
    Bookmark Topic Watch Topic
  • New Topic