Marker interface means , interface which has no methods.Then
what is the necessity of its usage.I read "it tells the
compiler that it should be treated differently ". "It is
used to store state of an object". But still am not
clear.Please explain clearly.
Answers were Sorted based on User's Feedback
Answer / pratap jadaun
Marker interface means, interface which has no methods. Then
what is the necessity of its usage. I read "it tells the
compiler that it should be treated differently ".
but the marker interface is not only
used to store state of an object
below given list of marker interfaces
- java,lang.Cloneable
- java,io.Serializable
-java.util.EventListener
....
these are marker interfaces in java and each interface is
used for different purpose
A class implements the Cloneable interface to indicate to
the Object.clone() method that it is legal for that method
to make a field-for-field copy of instances of that class.
"Serializable is used to store state of an object".
| Is This Answer Correct ? | 1 Yes | 1 No |
What environment variables are required to be set on a machine in order to run Java programs?
why are there separate wait and sleep methods? : Java thread
when there is a need of jvm then how we can say that java is a platform independent language?
What is a locale?
What is parameters example?
What are keywords give examples?
How to create an immutable class?
can any one send me the example program of immutable class?
what is a thread?
What is the difference between equals() and == in java?
Can a serialized object be transferred via network?
What are the data types supported by java? What is autoboxing and unboxing?