It's not a secret anymore!
The moose likes Beginning Java and the fly likes What is a Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is a Interface" Watch "What is a Interface" New topic

What is a Interface

Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
can anyone explain me what is an interface with an example

Ramesh Shanmugam - SCJP 1.5
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Moving to Java in General(Beginner).

[Jess in Action][AskingGoodQuestions]
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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

Joined: Dec 06, 2001
Posts: 3061
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.



Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: What is a Interface
It's not a secret anymore!