question: protected void saveObject ( Object object ) { if ( m_FileChooser == null ) { createFileChooser ( ) ; } int returnVal = m_FileChooser . showSaveDialog ( this ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { File sFile = m_FileChooser . getSelectedFile ( ) ; try { ObjectOutputStream oo = new ObjectOutputStream ( new BufferedOutputStream ( new FileOutputStream ( sFile ) ) ) ; oo . writeObject ( object ) ; oo . close ( ) ; } catch ( Exception ex ) { JOptionPane . showMessageDialog ( this , "Couldn't write to file: " + sFile . getName ( ) + "\n" + ex . getMessage ( ) , "Save object" , JOptionPane . ERROR_MESSAGE ) ; } } }
target:  Saves an object to a file selected by the user.