Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wat clarification on marker interface and it use

 
anilellendula kumar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wat clarification on marker interface? i knew that marker interface is the an interface it doesnot have any methods, if it doesnot have any methods wat is the use of implementing this methods? as per basic java fundamentals , an interface is nothing but it has all abstract methods where u implementing an interface we need derive the methods?but wat about the case in marker interfce


Ex: serilizable interface...
 
Qi Liang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good example is java.io.Serializable.

The marker interface works like a boolean flag to indicate the class implementing this interface has some capability, but there is not method involved.
 
anilellendula kumar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if it doesnot have abstratct methods, how it has become interface, as per basic java , interface is nothing but it has abstract methods, where u implement an interface , we need to derive the all methods of the an interface, But in marker interface it is NOT happening , why it is called as an interface




 
Qi Liang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think whether abstract method is defined is not the key that one interface becomes interface. Any way, in practice, the marker interface is used widely.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic