user2516848 user2516848 - 2 months ago 20
Java Question

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.

mtk mtk
Answer

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.