Search code examples
javamarker-interfaces

Null vs Marker Interface


Can anyone elaborate that what is the core difference between Null interface and Marker interface in Java. I have been asked this question in one of the interview.

Thanks.


Solution

  • Null interface is just another name for Marker Interface or the other way round. They are used interchangeably as far as I know.

    These are just interface with no methods in them. Examples of marker interfaces are : Serializable, Cloneable.