How does marker interface provides functionality to the
implemented class ?

or How dose maker interface gets the functionalities as
serialization or cloning.

Answer Posted / somasundar m

Marker interface is a an interface which doesnot have any
variables and methods. Since it is following the design
pattern called Marker Design Pattern its is called as
Marker interface. This marker interface just tells the
compiler that all the marked classes with certain interface
names should be treated differently. It is used just to
mark the selected classes to do a certain functionality.
Example Serializable, Clonnable, etc. Here Serializable is
a marker interface just compiler to indentify which are the
classes should be marked for serialization. Now it can be
replace with annotations.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What best practices should you follow while writing multithreaded code in java?

545


How do you convert string to int in java?

564


What are JVM.JRE, J2EE, JNI?

694


What is the difference between final, finally and finalize() in java?

521


How are multiple inheritances done in Java?

622






How do I compare two strings in word in java?

541


what is the difference between future and callable interface in java?

605


what is object slice?

1577


What do you mean by garbage collection used in java?

575


Why are functions called methods in java?

534


Define immutable object?

583


What do you mean by exception handling in Java?

662


How many decimal digits is 64 bit?

536


What is integer size in java?

514


Define class?

518