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.
Total Answers and Comments: 4
Last Update: September 05, 2007 Asked by: Rajasheker
RE: There is no methods in the marker interface,then w...
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..
RE: There is no methods in the marker interface,then w...
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.
RE: There is no methods in the marker interface,then w...
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.