Java - Interview Questions and Answers on "Marker Interfaces"

Q1.  What are Marker Interfaces ? Name few Java marker interfaces ?

Ans. These are the interfaces which have no declared methods.

Serializable and cloneable are marker interfaces.

Q2.  Is runnable a Marker interface ?

Ans. No , it has run method declared.

Q3.  Difference between serializable and externalizable interface ?

Ans. Serializable is a marker interface whereas externalizable  is not.

Q4.  What is a cloneable interface and what all methods does it contain?

Ans. It is not having any method because it is a MARKER interface.

Q5.  What is the purpose of marker interfaces ?

Ans. They just tell the compiler that the objects of the classes implementing the interfaces with no defined methods need to be treated differently. 

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus