Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What do you understand by a marker interface?

user-image
Question ajoutée par himanshu mittal
Date de publication: 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
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?