aspose file tools*
The moose likes Beginning Java and the fly likes Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interfaces" Watch "Interfaces" New topic
Author

Interfaces

Mathavan Balakrishnan
Greenhorn

Joined: Nov 10, 2005
Posts: 15
Hi friends

I want to know what is the actual use of interfaces in java.

I know that interfaces have methods that are not implemented.

Why do we use a thing that doesn't have any implementation ?

Can't we accomplish our task without interfaces ?

What is the speciality of interfaces ?

What interfaces can do that classes can't do ?

Can u please illustrate the use of interfaces with examples ?

Waiting for ur reply friends.

urs
Mathavan
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Originally posted by Mathavan Balakrishnan:

Why do we use a thing that doesn't have any implementation ?


Let's change your question a little bit. How does a class look to a client? Isn't it just a bunch of method invocations? The client has a type and one or more associated operations for that type. Given a reference type String, a client may invoke one of many available operations. Sometimes the client only wants a subset of those operations, but in any case, the client is exposed to many operations ("needle in a haystack") implied by the so-called "OO paradigm". Then, the client "interfaces" to an implementation through a very strict and formally defined contract. Isn't it then obvious what the advantages are of separating that contract from the implementataion of the contract?

Think a bit more. I won't do your homework for you


Tony Morris
Java Q&A (FAQ, Trivia)
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
This link to Sun tutorial for Interface.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interfaces