Link to home
Start Free TrialLog in
Avatar of david_d
david_d

asked on

Interfaces. What, Why, Where?

Hi,

I have been coding in Java for a while now, but I am interested why Interface classes are used? Could you name an example of using Interfaces.  This is NOT  school project, but every project that I have programmed, I have never created an Interface class.  I am just wondering if it is either my poor identification of classes or that I don't actually need to use them!

Thanks in advance.

Regards,

David.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

But you've used them so that should give you some understanding of there use.
One their main strength is that they allow you to seperate function, from implementation. The interface defines the function or contract but leaves the details of how it is actually implemented to the implementing class. Allowing you to potentially use different implementations without impacting on your application.

They also provide a means to implement multiple inheritance (try implementing multiple inheritance without using interfaces).

Hi David,

   This explanation may be useful. Interfaces can be used to abstract ur implementation from outside world. They are powerful when u start working on distributed computing technologies like RMI and EJB where ur business logic is hidden from the client side who gets a home object or remote object and makes method calls to get the functionality done.

Regards

Inmomi
ASKER CERTIFIED SOLUTION
Avatar of k.jones
k.jones

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of david_d

ASKER

I am sorry, but your proposed answer is does not explain what I am looking for.  It does not describe in enough detail about Interfaces.

The comment k.jones has provided, describes Interfaces in a clear and understandable manner.

Sorry.

David.
Avatar of david_d

ASKER

Thank you for your well descriptive comment/answer.

Thanks.

David.