how a marker interface gets its functionality and when we
implements a marker interface how it got invoked

Answer Posted / somasundar m

Marker interface are a design pattern which is used to mark
the classes for doing some specific actions. Marker
interface are just to mark the classes. For example
Serializable is a marker interface. So jvm looks for the
classes which are marked as serializable to serialize the
objects. It tells the compiler that the marked items
should be treated differently. Since it is a older design
pattern. Now a days Annotations has been introduced, so we
can replace the usage of marker interface with annotations.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is singleton pattern used?

532


What is numeric function?

544


Is hashset ordered?

553


What is set in java?

532


What is variable and constant explain with example?

534






When is the finalize() called?

704


Is char a method in java?

520


What are 3 boolean operators?

539


What class of exceptions are generated by the java run-time system?

640


What are streams in java 8?

552


What is the function of compareto in java?

595


What do you know about the garbage collector?

617


These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }

603


What is the difference between procedural and object-oriented programs?

528


What is java instanceof operator?

566