When you want to serialize an instance, remember that all of its instance variables, except those marked as transient, have to be serializable. Which means that these variables have to implement the Serializable interface. Do you see what I mean ?
Christophe Verré wrote:When you want to serialize an instance, remember that all of its instance variables, except those marked as transient, have to be serializable. Which means that these variables have to implement the Serializable interface. Do you see what I mean ?
Agreed Christophe
But since the instant private Keyboard k = new KeyBoard() is present inside the Computer class which is implenting Serializable interface, doesn't that make all its instances inside it automatically Serializable? Kindly elaborate with reference to this code example.