I have this list
LinkedList<ASD> list = new LinkedList<ASD>();
then, I add some objects which extend ASD
BSD bsd = new BSD(); // BSD extends ASD
list.add(bsd);
and serialize list.
How can I get it to serialize and deserialize teh bsd element as BSD and
not as ASD?
It is not a problem. All objects that you want to serialize must be instances of classes that implement
Serializable.LinkedListdoes it. Declare eitherASDorBSD(it does not matter in your case) to implementSerializableand try. Everything should work.