why marker interfaces are there in java

Answer Posted / maurya

an interface without any method is known as marker
interface. we use marker interface to actually mark for JVM
to distinguish that the class is belongs or subclass of ant
particular super class.
EX-->
we have an interface named serializable. there is a
condition that if you want to serialize your object u must
have to implements marker interface.
by doing this we just only inform JVM that my class is able
to be serialized. JVM detact it at run time by using Class
class methods.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is array serializable java?

516


What is an class?

593


Is there any limitation of using inheritance?

569


Can a class be defined inside an interface?

562


What are the difference between string, string builder, and string buffer in java?

551






What is qms certification?

520


What are java packages? What's the significance of packages?

624


how does multithreading take place on a computer with a single cpu? : Java thread

689


State some situations where exceptions may arise in java?

625


Explain scope or life time of local variables in java?

557


Tell us something about an iterator.

544


Explain the public class modifier?

503


What is string substring?

562


What are exceptions

641


When object is created and destroyed?

638