コード例 #1
0
ファイル: Solution.java プロジェクト: deft1991/JavaRush
  public static void main(String args[]) throws Exception {
    FileOutputStream fileOutput = new FileOutputStream("your.file.name");
    ObjectOutputStream outputStream = new ObjectOutputStream(fileOutput);

    Solution solution = new Solution();
    outputStream.writeObject(solution);
    System.out.println(solution.getMap().size());

    fileOutput.close();
    outputStream.close();

    // loading
    FileInputStream fiStream = new FileInputStream("your.file.name");
    ObjectInputStream objectStream = new ObjectInputStream(fiStream);

    Solution loadedObject = (Solution) objectStream.readObject();

    fiStream.close();
    objectStream.close();

    // Attention!!
    System.out.println(loadedObject.size());
  }