Monday, December 31, 2012

Marker Interface in java

Marker Interface in java :

Interfcaes with no methods are known as Marker interface.

Java Marker Interface Examples :
    java.lang.Cloneable
    java.io.Serializable
    java.util.EventListener
   
Suppose you need to persist(save) the object then need to implement the
java.io.Serializable interface otherwise compiler will throw exception.
We can take another example we need to clone any object that class neither
implemented java.lang.Cloneable interface nor that superclass implemented .
Otherwise while calling clone() method will throw error.

No comments:

Post a Comment