Can Interface absolutely blank What is use of such interface

Can Interface absolutely blank What is use of such interface

Answer: Yes. There is no technical difference between “standard” and “marker” interfaces.

When you define an interface and define methods that implementing classes should have. If you don’t specify any methods we call the interface a marker interface, since it only marks the class as having some property.

Examples of that are Serializable, Cloneable etc. Those interfaces don’t define any methods themselves, but by convention and specification you have to option to implement some special methods related to them, e.g. some serializaton methods related to Serializable. The core Java libraries would then use reflection to check whether those methods exist if a marker interface is implemented.

More details: Refer question 2 answer

Leave a Reply

Your email address will not be published. Required fields are marked *

I am not Robot *