If a Marker Interface does not have any methods, how does it work?

A marker interface doesn’t “work” as such. As the name suggests, it just marks a class as being of a particular type. Some other code has to check for the existence of the marker and do something based on that information.

These days annotations often perform the same role that marker interfaces did previously.

Leave a Comment

tech