MordechayS MordechayS - 1 year ago 53
Java Question

Java: What can and what can't be serialized?

If the

interface is just a 'marker-interface' that is used for enabling some-sort of meta-data about classes in java - I'm a bit confused:
After reading the process of java's serialization algorithm (metadata bottom-to-top, then actual instance data top-to-bottom), I can't really understand what data cannot be processed through that algorithm.

And in short and formal: What data may cause the
and how should I know that I should not add the
implements Serializable
for my class?

Answer Source

When you are talking about NotSerializableException it is throw when you want to serialize an object, which has not been marked as Serializable - that's all, although when you extend non serializable class, and add Serializable interface it is perfectly fine.

There is no data that can't be serialized.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download