code: public static Object readObjectFromFile(File f) {
          Object obj = null;
          try {
              FileInputStream fin = new FileInputStream(f);
              ObjectInputStream ois = new ObjectInputStream(fin);
              obj = ois.readObject();
              ois.close();
          } catch (Exception e) {
              System.out.println("Error reading Object from file: "
                      + e.getMessage());
              return null;
          }
          return obj;
      }
docs: Reads in a file that contains only an object