File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Marker classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Marker classes" Watch "Marker classes" New topic

Marker classes

Unnati Redkar

Joined: May 14, 2007
Posts: 5
Hi ,

i am trying to figureout the significance of empty/marker classes in java.
In what scenario are they used?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I think you mean Marker Interfaces.

Google for that term (maybe plus "java") and you'll get plenty of information.

Note that Marker Interfaces, while still used by plenty of current Java APIs, should not be created(*) in new code. If you were thinking of creating a new Marker Interface, it would usually be better to create a new type of Annotation.

(*) Note that I say "created", not "used".

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
santosh joshi

Joined: Aug 20, 2007
Posts: 21
My understanding about the Marker Interfaces is that

it is just a Flag. which is tested by the compiler to do certain things

For certain things the compiler checks weather this flag is on or not
in java terms weather the Marker Interface is implemented by the class or not

for example whenever we want to serialize an Object we have to implement the Serializable interface . now when compiler sees the Markar tag( implemtts Serializable ) in a class it makes an understanding that yes this class is a candidate for serialization

There are many marker interfaces in java You just check with them

I agree. Here's the link:
subject: Marker classes
It's not a secret anymore!