Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What do you understand by a marker interface?

user-image
Question added by himanshu mittal
Date Posted: 2013/06/29

an interface which has no methods at all, they are just added to give some special features to a program, example cloneable interface, serializable interface

Daanish Rumani
by Daanish Rumani , Product Manager , Publicis Sapient

A marker interface is one that does not have any methods.
It is used to mark classes and other interfaces to denote something.
Clonable and Serializable interfaces are examples.
So if a class implements a marker interface we say that the class has been marked with the marker interface.
Interfaces are also marked with a marker interface.
The documentation of the Serializable interface demonstrates this fact: http://docs.oracle.com/javase/1.4.2/docs/api/java/io/Serializable.html As you can see many interfaces such as Attribute, NamingContext, PrivatKey, ThreadPolicy, etc.
extend the Serializable interface.
This implicitly means that any class that implements any of these interfaces need to be Serializable.

Zakaria Alam
by Zakaria Alam , Software Engineer , Wavelet Solution

An interface is called a marker interface when it is provided as a handle by java interpreter to mark a class so that it can provide special behaviour to it at runtime and they do not have any method declarations.
But as far as I know, it is depricated by annotation

It is one of Special kind of Interface it is BLANCK interface...

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.