• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Marker classes

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,


i am trying to figureout the significance of empty/marker classes in java.
In what scenario are they used?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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".
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic