This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Use of Marker Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Use of Marker Interface" Watch "Use of Marker Interface" New topic

Use of Marker Interface

Karthikeyan Ramaswamy
Ranch Hand

Joined: Apr 30, 2008
Posts: 42
hi all,

what is the use of Marker interface(interface have no methods).


above interface has no methods to implement.
so, my question is what is purpose for and how it's working.
and when we can write user-defined marker interface.
b panigrahy

Joined: Apr 11, 2006
Posts: 14
Marker interface is meant for Reference type checking

Ex. if class A implements then when you transfer object of class A using ObjectOutputStream class then it will check inside writeObject(Object obj, boolean unshared) method.

Code snippet is :
if (obj instanceof Serializable) {
writeOrdinaryObject(obj, desc, unshared);
}else {

Marker is a logical term .
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 445


It also provides functionality without the developer having to code for the same.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

"Karthikeyan R",
Please check your private messages regarding an important administrative matter.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Use of Marker Interface
It's not a secret anymore!