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

how can i take the inputs from users in java program?

7 Answers   Wipro,


Which class contains a method: cloneable or object?

0 Answers  


How to sort a collection of custom Objects in Java?

0 Answers  


what is Thread?

6 Answers  


What is integers and example?

0 Answers  






Which method must be implemented by all threads?

0 Answers  


What is parseint?

0 Answers  


What are constants and how to create constants in java?

0 Answers  


What is the default initialized value of String type variable?

4 Answers  


What is the final class modifier?

0 Answers  


What will happens if you opened Internet Explorer 4 times?

2 Answers  


What is the need of transient variables in Java ?

0 Answers   MCN Solutions,


Categories