0

i came through lot of documentation on books and online stuff. in my understanding marker interfaces in java are for only developer information(for example implementing the serializable lets the developer aware that, this may be transferred over n/w and need be careful with sensible data. So he can make few fields volatile).

Other than this, JVM will not add any special behaviour to classes implementing serializable, right?)

i decompiled the code of writeObject and i understand it checks for instanceOf, but the purpose here to let the developer knows that this can be serializable. correct?

This applicable to all marker interfaces ? or JVM adds any special behaviour to classes implementing marker interfaces?

-Rana

user2555212
  • 165
  • 1
  • 14
  • that's the purpose, but the way it is checked is like if ( myObject instanceof Serializable ) { -> can be serialized; } else { can't be serialized; } – Stultuske Feb 08 '19 at 10:41
  • 1
    Possible duplicate of [What is the use of marker interfaces in Java?](https://stackoverflow.com/questions/1995198/what-is-the-use-of-marker-interfaces-in-java) – Jaspreet Jolly Feb 08 '19 at 10:44

0 Answers0