Monday, February 21, 2011

Interview questions -- Serializable

Suppose I have 2 classes
1) Person having person name = "Yogesh";
2) User having username = "User" extends Person and implements Serializable.

What will be the values printed if I serialize and deserialize the User object?

I guessed it wrongly and answered that personname will not get printed as Person class is not serializable. BUT THAT WAS WRONG !!!

Both the values will be stored and retrieved correctly. The reason I don't know, but, this scenario, I have tested on PC

No comments:

Post a Comment