• 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 interface

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the use of Marker interface in Java?

Regards,
aakash
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
to indicate something about a class, for something that can use the reflection API. good example is servlet implements SingleThreadModel if i declare "implements SingleThreadModel", an interface whiuchn is a marker (IE has no methods) i am telling the servlet container that my servlet is not thread-safe and that a new instance should be started to handle requests. so i am giving the user of the class a message which can be tested like this:

peter
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Akash,
Marker Interface is a synonym for TagInterface.
An idiom used in Java, and possibly other languages. It's an interface that indicates the class is meant or allowed to be used for a particular purpose. A classic example is the cloneable interface in Java. Classes that "implement Cloneable" (see below) can be copied using the clone() method.
class Example implements Cloneable
Goodday,
Gaya3
------------------------------------------------
Beginning is half done
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic