What is Marker Interface

What is Marker Interface:
  • A interface without any member is called Marker Interface.
  • It is just an empty interface.
  • The uses of Marker Interface is to send the special message to JVM about the class
Example of Marker Interface:

when we want to make a clone of any class object then we need to send the instruction to JVM that class is eligible for cloning. we can do this by implementing the marker interface.


package com.javaforecast4u.file;

public interface JFCUCloneable {


 Class implemented this interface

package com.javaforecast4u.file;

public class Employee implements JFCUCloneable{
       int empId;
       Employee(int empId){
              this.empId = empId;
       public Employee empClone() throws CloneNotSupportedException {
              if(this instanceof JFCUCloneable){
                     return new Employee(empId);
                     throw new CloneNotSupportedException("Clone Not support ");

Test Class

package com.javaforecast4u.file;

public class MarakerInterfaceTest {

       public static void main(String[] args) throws CloneNotSupportedException{
              Employee emp = new Employee(1001);
              Employee emp1 = new Employee(emp.empId);
              System.out.println(emp == emp1);



1 comment :

  1. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android training in chennai
    Ios training in chennai