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



Marker interface means , interface which has no methods.Then what is the necessity of its usage.I r..

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

Marker interface means , interface which has no methods.Then what is the necessity of its usage.I r..

Answer / ras

To store the state of object

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is time complexity algorithm?

0 Answers  


What are the types of inner classes (non-static nested class) used in java?

0 Answers  


Is oracle charging for java?

0 Answers  


Can we serialize singleton class?

0 Answers  


what is polymorphism?

4 Answers  






What is canonical name in java?

0 Answers  


Difference between a MenuItem and a CheckboxMenuItem?

1 Answers  


What is the symbol for average?

0 Answers  


How can you read an integer value from the keyword when the application is runtime in java? example?

0 Answers   HCL,


What is the difference between checked exception and unchecked exception?

0 Answers  


What is the purpose of using break in each case of switch statement?

0 Answers  


What are packages in java?

0 Answers  


Categories