posted 16 years ago
All collection classes implement Serializable, so you can e.g. serialize an ArrayList.
If you want the contents stored inside back, also this objects need to be serializable.
The main reason why a variable is marked transient is that the object it holds is not serializable.
You won't be able to serialize the collection if an object that's inside is not serializable. You would get a otSerializableException.
If it is transient, you will get your collection back, and where the transient variables were you'll get null:
Example:
output is:
before:
[Cat with 9 lives, Cat with 7 lives, StrangeCat with 9 lives and with a Mouse: Mouse@130c19b]
after deserialization:
[Cat with 9 lives, Cat with 7 lives, StrangeCat with 9 lives and with a Mouse: null]
StrangeCat also implements Serializable (by inheritance).
Yours,
Bu.
all events occur in real time