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

Global Infrastructure and its components in AWS

You may operate your workloads wherever and however you choose with the AWS Global Infrastructure, and you'll use the same network, cont...