• 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

Purpose of using Interface in projects or within applications

 
Ranch Hand
Posts: 214
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

We use Interface in our application what is the main purpose of using it? Can we use only sub classes or abstract classes instead of interface?Please explain it.


Thanks in advanced.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question has been ask a LOT before...if you searched, you probably would have already found the answer.

In brief, it lets you be more flexible in how you write code. It shouldn't matter to me if the data is stored as a linked list, a hash table, an array, or something else. All i want to do is getNextElement(). If I write my code to use the interface, I can change the underlying data structure as much as I want, as long as it still implements the interface and has a getNextelement() method.

Search this forum for more posts on this same topic, and you'll find more detail.
 
Rd Dari
Ranch Hand
Posts: 214
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:
Search this forum for more posts on this same topic, and you'll find more detail.


I searched a lot but I did not find here particular topic so please tell me exact motive of using it. Give some real world example if its possible.It will be appreciable.

Thank you!
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I searched a lot but I did not find here particular topic


what about this, this, or this?

 
Rd Dari
Ranch Hand
Posts: 214
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for it.....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic