The second line uses a
pattern called Decorator pattern which adds some extra functionallity to the FileOutputStream at the runtime but still acting on the same object.
Generally FileOutputStream is used to write some data to the file but in your case you want to write the object into a file...FileOutputStream itself can not do it,so you decorating the FileOutputStream using ObjectOutputStream and telling that whatever the ObjectOutputStream is sending send it to the file.
You can read about the Decorator pattern
here