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
Write a method to check if input string is palindrome?
What is your platform?s default character encoding and how to know this?
Is object a data type?
what is abstract class in Java?
Explain about assignment statement?
What is the basic difference between string and stringbuffer object?
What is string :: npos?
What is return null in java?
If goto and const is reserve words than why it is not work in java?
Is java a pure object oriented language?
What is multithreading in java?
What is stream api in java8?
How will you initialize an Applet?
What is a line separator in java?
What is void data type?