Marker Interfaces- A marker interface is one which has absolutely nothing in them.They have no methods or variables.They are used to give permission to a class to execute a particular functionality.
Interface M{
}
Examples are Cloneable Interface,remote Interface,Serializable Interface etc.
We know that we have a clone method in which we can clone an object i.e make a bit by bit copy of an object.But to make a clone of an object the class should implement the Cloneable Interface to have permission to make Clone objects.
Now let us see what clone method does
A a2= new A();
So here both a1 and a2 point to 2 different objects of A i.e to two diff memory locations where content of members corresponding to these two different objects iss stored.Now let us do one thing
a2 = a1;
Now a2 will start pointing to the same object or the memory location to which a1 is pointing to.
But if we now do
a2 = a1.clone();
This will create a new memory location and a2 will start pointing to this new memory location and all the content of member variables corresponding to objectof class A to which a1 was pointing to will also be COPIED to this memory location as well.