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 |
How do you achieve polymorphism in java?
Can we add two byte variables and assign the result to a byte variable ? b=b1+b2 where b,b1,b2 are byte types
Explain the difference between jdk, jre, and jvm?
How to display arraylist values in java?
Is static a keyword in java?
What are triggers in DB? Explain their types. How do they work?
how to print the below in java?thanks in advance.... * * * * * * * *
What is main method?
What is composition in java?
Explain the difference between static and dynamic binding in java?
Write a java program that prints all the values given at command-line.
What restrictions are placed on method overloading in java programming?