How Marker Interface is handled by JVM

后端 未结 7 677
清歌不尽
清歌不尽 2020-12-09 23:07

Marker interface doesn\'t has any thing. It contains only interface declarations, then how it is handled by the JVM for the classes which implements this marker interface?

7条回答
  •  抹茶落季
    2020-12-09 23:37

    Take Exampe of clone(). Actually clone() is defined inside Object class. But it is protected. You can use it only if your class is implementing Cloneable interface. So what happens is, when you implement Cloneable, you get the right to use clone(). Interface doesn't contain any methods! Got it ?

提交回复
热议问题