If an interface doesn't contain any methods and by implementing that interface if our objects get some abilities such type of interface are called marker interfaces / Ability interface / Tag interface
Example
1.serializable
2.Cloneable
3.RandomAcess
4.SingleThreadModel
these are a marker for some abilities
By implementing a serializable interface our objects can be saved to files. and can travel across the network by implementing a cloneable interface with our objects in our position to produce clone objects.
without having any method how the objects get ability in marker interfaces?
internally JVM is responsible to provide the required ability.
Why JVN is providing the required ability in marker interfaces?
to reduce the complexity of programming and make java language simple.
Is it possible to create our own marker interface?
Yes. customization of JVM is required
0 Comments