I know marker interface in java. It is used to define a specific behaviour about a class. For example, Serializable interface has the specific ability to store an object into by
Serialization is handled by the ObjectInputStream
and ObjectOutputStream
classes. If a class has special serialization needs, the methods to create are outlined in the API. Reflection is used to invoke these methods.
The same way you would write any other interface.
There's nothing stopping you from putting methods in a marker interface.
The more common practice now is to use annotations to provide the same metadata marker interfaces provide.