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


Please Help Members By Posting Answers For Below Questions

Explain about wait() method?

559


What is "this" keyword in java? Explain

651


what is the swingutilities.invokelater(runnable) method for? : Java thread

539


What is meant by class loader? How many types are there? When will we use them?

497


How do you do exponents in java?

530






What is use of static method?

528


What is unicode used for?

564


How is hashset defined in java?

514


What is the purpose of static methods and variables?

523


What is externalizable?

608


What is meant by flickering?

645


What is java command?

562


'A class is a template for an object' explain this statement.

539


How do I type unicode?

523


Why java is secure? Explain.

582