answersLogoWhite

0

Generally, they are used to give additional information about the behaviour of a class.It is just used to "mark" Java classes which support a certain capability . Examples: java.util.RandomAccess

java.io.Serializable

java.rmi.Remote

java.util.EventListner

javax.servlet.SingleThreadModel

java.lang.Clonable

javax.ejb.EnterpriseBean

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
More answers

Marker interface is used as a tag to inform a message to the java compiler so that it can add special behaviour to the class implementing it. Java marker interface has no members in it

Lets take the java.io.Serializable marker interface. It doesnot has any members defined it it. When a java class is to be serialized, you should intimate the java compiler in some way that there is a possibility of serializing this java class. In this scenario, marker interfaces are used. The java class which may be serialized has to implement the java.io.Serializable marker interface. In such way, we are intimating the java compiler.

Naresh Tuhania From IBM

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Purpose of marker interface in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp