Um, no, the problem is that you are trying to serialise the FileOutputStream, fs.
You should be trying to serialise the Forest, f.
The exception message told you that: it said that FileOutputStream was not Serializable, which it isn't!
Rahul is right to say that Tree needs to be Serializable, but that's not the cause of the exception you are currently getting.
By the way, this is an example of why you should not use short, meaningless identifiers like "f" and "fs" for your variables. If they were called "forest" and "fileStream", I bet you'd have spotted the problem. We're not writing FORTRAN-66 - you can have meaningful identifiers in
Java.
[ July 26, 2007: Message edited by: Peter Chase ]