• 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

what is mean by Marker interface?

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

what is mean by Marker interface?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
An interface which contains no methods or member variables will be called as Marker Interface. For eg:- Remote, Serializable or marker interfaces. Why because, the compiler will check whether that class is an instance of that interface ( for eg:- serializable) and if it is true means, it will serialize that object.

Regards,
Loga
 
ganesh pol
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have not got it yet
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Marker interface is used to indicate that a class can be used for a specific purpose. Look at the Serializable interface, it actually has no methods that you have to implement. But it indicates that a class that implements this interface can be (de)serialized (converted to a byte representation).

If you, for instance, want to save an object to disk using an ObjectOutputStream, only objects that implement the Serializable interface can be saved.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A marker interface is indeed a interface that contains no methods.

Why is this useful --> polymorphism
reply
    Bookmark Topic Watch Topic
  • New Topic