File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Problem in understanding -how interface helpful Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem in understanding -how interface helpful" Watch "Problem in understanding -how interface helpful" New topic

Problem in understanding -how interface helpful

abdul ambalam

Joined: Dec 01, 2003
Posts: 1
interface does not have method implementation. only class which implements interface must implememt all the methods defined in interface.
My question is why should we implement interface as we can write our own code. In java, Serializable and Cloneable dont have anything inside. How it is useful in serializing and cloning objects. does compiler have anything to understand these interfaces. I have many question regarding interfaces.
Can anyone answer to all the possible questions reg-interfaces. Thankyou.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33134

The interface is a way of declaring your intent. While Serializable doesn't have any required methods, you are telling the compiler that it is ok to serialize your object.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Problem in understanding -how interface helpful
It's not a secret anymore!