You simply did not correctly implement your customized writeObject() method. If you look closely, you have simply swallowed a letter 't'. VM is using a default method writeObject which does not write your integer value returned by Bulb class method getPower( ). Subsequently, when you try to retrieve the value from a serialized file, readInt( ) method throws IOException.
The important thing is not to stop questioning.
Joined: Feb 23, 2009
Thanks Bob and Peter, I really misspelled the method name.