what is use of marker interface? give me good example?

Answer Posted / aravind

In java language programming, interfaces with no methods are
known as marker interfaces. Marker interfaces are
Serializable, Clonable, SingleThreadModel, Event listener.
Marker Interfaces are implemented by the classes or their
super classes in order to add some functionality.

Suppose the interface Clonable is neither implemented by a
class named Myclass nor it's any super class, then a call to
the method clone() on Myclass's object will give an error.
This means, to add this functionality one should implement
the Clonable interface. While the Clonable is an empty
interface but it provides an important functionality.

Is This Answer Correct ?    10 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is double checked locking in singleton?

604


What are serialization and deserialization?

719


Can we override singleton class?

528


why doesn't java run on all platforms?

565


What are variable arguments or varargs?

562






What mechanism does java use for memory management?

486


Can we execute java program without main method?

516


Differentiate between class and structure.

622


What is the functionability stubs and skeletons?

679


Why singleton is not thread safe?

561


Why does java doesnt suuport unsigned values?

1792


How do you do exponents in java?

534


List types of storage classes in java?

615


What is memory leak and how does java handle it?

515


What is difference between core java and java ee?

464