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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / devendra.m

Marker interface is a interface,in which that,it doesn't
have any methods...just which is giving mark to the run time
environment.
clonable,serializable,singleThreadModel are marker interfaces.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What kind of variables can a class consist?

0 Answers  


what are the differences between java and .net?..why u choose java?

1 Answers  


What are assembly attributes?

0 Answers  


What is command line argument

0 Answers   TCS,


Is arraylist an object in java?

0 Answers  






write the hierarchy of component class?

1 Answers  


Write a program to reverse array in place?

0 Answers  


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

0 Answers  


What is difference between calling start() and run() method of thread?

0 Answers  


What does %d do in java?

0 Answers  


What is meant by collection in java?

0 Answers  


How can I right-justify a string?

0 Answers   Aspire, Infogain,


Categories