mausam
Posts: 243
Nickname: mausam
Registered: Sep, 2003
|
|
Re: Interfaces and Abstract Classes
|
Posted: Jan 2, 2004 4:41 AM
|
|
First point...
>everybody knows that an interface is a class which does not >provide implementation to all its methods >but Serializable interface has no methods
Not having any method does not violate the rule "does not provide implementation to all its methods"
In any case its not providing any implentation to anymethod.
Now whats the use of such interface...
What i know (correct me plz if wrong) is that interfaces like..
java.io.Serializable, java.rmi.Remote, java.util.EventListener, javax.s ervlet.SingleThreadModel
are "marker" interfaces, with no methods of its own to be implement in implementing class.
like in case of Serializable the VM agrees to do the work if you simply implement Serializable.
Its like a main method is not a main method if its not static,public and has an array as parameter.
VM looks for such method and finds its a main.
Similary a class implenting Serializable interface is marked as VM for serialization.
Any more inputs??
|
|