help me what's wrong in this code ....
First, a bit of side information.... The serialization code actually keeps track of what has been written. And if you write an object twice, it will simply mark it as a repeated write -- and not actually write it.
Why is this needed? Let's say you have a circular linked list, and you write one of the nodes. If this behavior didn't exist, the serialization code will contiue traversing the linked list, forever writing the nodes that it finds. With this behavior, eventually, it will just write that it encountered an object that was already written and stop.
On the deserialization side, it will get a message that the object was a read of an eariler object, and get the same reference as the earlier dersialized object.
Now back to your question...
When you did "d1=d", you actually assigned the d1 variable to the same object as the d variable -- an object that already have been serialized.
So, when you later write d1, it actually doesn't do it -- it just writes that it has been written eariler (and marked to the location with the previous values). When you deserialize, you will get the same reference for the first and third object -- and it deserializes to the values that was written first.
Henry