• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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: 13082
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: 13082
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.....
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic