Possible Duplicate:
What is the use of marker interfaces in Java?
What are marker interfaces and why are they used?
Possible Duplicate:
What is the use of marker interfaces in Java?
What are marker interfaces and why are they used?
There is an article on wikipedia on that subject which I suggest that you read.
Marker interface provides extra functionalities.
they doesnt have body. they are empty inferfaces
It means an interface with nothing more than a name. No methods for you to implement. It's a way of putting your class in a certain category just by stating that it's in the category. I've seen it used for exception hierarchies, but I'm sure there are other applications.
Example usage in java:
if (obj instanceof MarkerInterface) {
// do marker interface related stuff
}
A so-called marker interface is a Java interface which doesn't actually define any fields. It is just used to "mark" Java classes which support a certain capability -- the class marks itself as implementing the interface. For example, the java.lang.Cloneable interface.
Marker Interface
In java language programming, interfaces with no methods are known as marker interfaces. Marker interfaces are Serializable, Clonable, SingleThreadModel, Event listener. Marker Interfaces are implemented by the classes or their super classes in order to add some functionality.
e.g. Suppose you want to persist (save) the state of an object then you have to implement the Serializable interface otherwise the compiler will throw an error. To make more clearly understand the concept of marker interface you should go through one more example.
Suppose the interface Clonable is neither implemented by a class named Myclass nor it's any super class, then a call to the method clone() on Myclass's object will give an error. This means, to add this functionality one should implement the Clonable interface. While the Clonable is an empty interface but it provides an important functionality.