Skip to main content

Posts

Showing posts with the label Tagged Interface

Why Marker Interface Does Not Have Method Declarations?

Every Java programmer knows that Marker Interface does not have any methods in it. Some of you confused if there are no any method declarations, and then what is the use of Marker Interface or Tagged Interface. But very few people know why we use Marker Interface and its use in our programs. Whenever any class implementing some Marker Interface, just we are telling to JVM to do that particular functionality of interface. So JVM checks that class or it's super class is implementing the Serializable interface or not. That means serialization process is taken care by JVM itself. So you no need to write any code for serialization. Then what is the use of method declarations in Serializable interface when JVM is going to do everything for us.