code: public static Object readObjectFromFile(File file) throws IOException, ClassNotFoundException {
      FileInputStream fs = new FileInputStream(file);
      ObjectInputStream os = new ObjectInputStream(fs);
      Object object = os.readObject();
      os.close();
      return object;
    }
docs: Reads a single object from a file.
  @param file The <code>File</code> to read from.
  @return The <code>Object</code> read from the file.
  @throws IOException If the file could not be read.
  @throws ClassNotFoundException If the object's class could not be found.