Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. @Override
  2. public void save() throws Exception {
  3. PrintWriter out = new PrintWriter("Calculator.out");
  4. for (int i=history.size()-1 ; i>=0 && i>=history.size()-5 ; i--) {
  5. out.println(history.get(i));
  6. }
  7. out.close();
  8. }
  9.  
  10. @Override
  11. public void load() throws Exception {
  12. history.clear();
  13. BufferedReader in = new BufferedReader(new FileReader("Calculator.out"));
  14. String line;
  15. while ( (line = in.readLine()) != null) {
  16. history.add(line);
  17. }
  18. curIndex = history.size()-1;
  19. in.close();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement