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.
Answer Posted / 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 |
Post New Answer View All Answers
What is the name of the java compiler?
What is the syntax and characteristics of a lambda expression?
Can you override static methods?
What is object-oriented paradigm?
Which class cannot be a subclass in java?
What is variable explain?
Explain about fail safe iterators in java?
How does regex work?
What are the different types of data structures in java?
Is space a char?
How do you add an element to a hashset in java?
When we serialize an object does the serialization mechanism saves its references too?
Difference between a class and an object?
How do you know if a value is nan?
what is method reference in java 8?