There is no methods in the marker interface,then what is the use of marker interface.And what is the functionality of the interface.Why we need to implement marker interface.

Showing Answers 1 - 5 of 5 Answers

Jiji

  • Oct 13th, 2005
 

Marker interfaces are used to show that a class is able to do something..
like the remote, serializable, cloneable.. etc..
only a class which implements serializable can be serialized..
only a class which implements the remote interface can be sais that a remote object.. etc..
hope u have got someidea..

  Was this answer useful?  Yes

Sreenivas Rao

  • Oct 17th, 2005
 

Marker Interfaces are very useful, but it doesn't consists anu methods.

these interfaces are must be implemented by the class itself.

for ex. Serializable, cloneable, Single Thread Model, EventListener, Remote are marker interfaces

  Was this answer useful?  Yes

HariKrishna G

  • Oct 31st, 2005
 

In java interfaces are used to describe the behaviour, and whereas the class for describing both the state and behaviour.There are certain important operations such as storing the state of the object, cloning an object, dealing with threads etc, wherein we dont want the user to do any specific coding, but we want that behaviour to be achieved. In these cases we can declare the interfaces as a MARKER interface or a TAGGED interface.When we implement a marker interface, ultimately we will be getting the features incorporated in it, without writing any piece of code.

  Was this answer useful?  Yes

rajeev sangam

  • Sep 5th, 2007
 

Marker interfaces are the degenerate case of contract beacause as we know they define no language-level behaviour- no metods or values. All their contract is in the documentation that describes the expectations you must satisfy if your class implements that interface.

Do not  be fooled into thinking that they are unimportant merely because they have no methods.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions