Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is mean by Marker interface?

 
ganesh pol
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friends

what is mean by Marker interface?
 
Krishnan Loganathan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
i have not got it yet
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • 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.
 
Andrew Nomos
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A marker interface is indeed a interface that contains no methods.

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