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.
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.
these two links are pretty good:
http://www.javaworld.com/javaworld/javaqa/2001-08/03-qa-0831-interface.html
http://www.javaworld.com/jw-12-1998/jw-12-techniques.html
http://www.javaworld.com/javaworld/javaqa/2001-08/03-qa-0831-interface.html
http://www.javaworld.com/jw-12-1998/jw-12-techniques.html
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
The comment k.jones has provided, describes Interfaces in a clear and understandable manner.
Sorry.
David.
ASKER
Thank you for your well descriptive comment/answer.
Thanks.
David.
Thanks.
David.
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).