Vishal Hegde wrote:I have Serialization query using writeObject() & readObject() method to add Transient variable, but its giving null pointer exception for "after: collar size is please advice where I am going wrong.
Vishal, could you please show us the entire error message
exactly as you get it; otherwise we're just guessing.
One thing I did notice:
Dog.readObject() should be
private.
Also: those
try...catch blocks of yours may be causing problems, since they don't halt execution. With something like serialization, it's much better to just let the program fail. Indeed, until you're sure that everything's working, I wouldn't use
any try...catch blocks.
Winston