Friday 8 December 2017

What is Marker interface and Why it is required in Java?

Marker Interface is an interface which have no fields or methods within it.
An empty interface  is called a marker interface.
It is used to convey to the JVM that the class implementing an interface of this category will have some special behavior.

Examples of marker interface are Serializable, Clonnable and Remote interface.

If JVM finds a Class is Serializable, Clonnable and Remote interface then it will do some special operation on it .Marker interface indicates command to JVM or compiler to do some special operation.So that marker interface is required in java


Example:
Public interface Serializable
{
//
}

No comments:

Post a Comment

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...