• 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

Why Marker Interface?

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

When we say that Marker Interface has no methods, why do we need it at all?

Why should we have a interface with NO methods and implement it?

Please answer me! Thanks!

- Mani
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is asked often. Have a search through the forum, you will find plenty of answers.
[ August 08, 2005: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/377400/java/java/marker-interface

<repeat>
A marker interface is used to inadvertantly introduce a design flaw.
A marker interface is typically better described as "metadata" with some contractual properties associated with it.
For example, you could eliminate the java.io.Serializable marker interface and introduce a Serializable annotation with associated contract (i.e. in the javadoc), since it is annotations that are the correct tool for metadata, and prior to 1.5, mere javadoc; it has never been interfaces, despite the flaws that are evident in the core API.
</repeat>
reply
    Bookmark Topic Watch Topic
  • New Topic