• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is a Interface  RSS feed

 
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
Sheriff
Posts: 24217
38
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!