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 are byte codes?
What are the advantages of exception handling?
Can we sort hashmap in java?
What java is used for?
How do you include a string in java?
what is collatration?
Can we declare a class as abstract without having any abstract method?
Why is the type for real numbers called double?
Is special character in java?
Where is singleton pattern used?
Can we modify the throws clause of the superclass method while overriding it in the subclass?
What is vector capacity in java?
Which keyword specify that a variable is effectively final ?
What is parsing a sentence?
What is flag in java?