This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is a Interface

 
Ramesh Shanmugam
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone explain me what is an interface with an example
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
an interface is a contract.
It tells any class accessing an object what methods and behaviours are guaranteed to be in place in that object without telling anything about the actual implementation of those methods.

Check out the API docs for java.util.List and the implementing classes for some good examples.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interfaces are a pretty basic principle in Java. I'm quite certain they have been discussed here before. You should use the Search tool to find the previous threads. Also any decent Java text or online tutorial will have much more detail than can be given here.

HTH

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic