What is Marker Interface
Answer: A marker interface is an interface with no method declarations. They just tell the compiler that the objects of the classes implementing the interfaces with no defined methods need to be treated differently. These Marker interfaces are used by other code to test for permission to do something.
Java Marker Interface:
- Serializable
- Clonable
- RandomAccess
From java 1.5, Introduction of java annotation feature can be use to define Marker Interface as example shows below:
Marker Interface:
package com.javahonk.markerinterface; interface MarketInterfaceExample { }
Using Annotation Marker Interface:
@interface AnnotationUserMarkerInterface{ }
Marker Interface is used to convey to the JVM that the class implementing an interface of this category will have some special behavior. Many thanks for sharing this tutorial.