How Marker Interface is handled by JVM

后端 未结 7 676
清歌不尽
清歌不尽 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:42

    The word "serializable" is confusing in this context, as many novice programmers like myself take it to mean that "serializable" interface does the serialization, i.e. the process of converting the abstract data type to bytes. But as the literature shows, serializable interface is just a "marker" and the real work of converting ADT to bytes (I will call this the process of getting metadata) is done by ObjectOutputStream. Similarly deserialization is done by ObjectInputStream.

提交回复
热议问题