File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Marker classes" Watch "Marker classes" New topic
Author

Marker classes

Unnati Redkar
Greenhorn

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
Greenhorn

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

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Marker classes