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

Why pointers are not used in java?

570


What are some examples of variable costs?

481


Is arraylist an object in java?

590


What is import java util arraylist?

646


Is .net better than java?

548






When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

602


What is get () in java?

556


List some oops concepts in java?

573


What is mysql driver class name?

545


Can interface be private in java?

537


How to avoid memory leak in java?

588


How many arguments can be passed to main ()?

518


What is the difference between method overriding and overloading?

569


Why arraylist is not synchronized in java example?

459


What is a java string?

532