Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void save() throws Exception {
- PrintWriter out = new PrintWriter("Calculator.out");
- for (int i=history.size()-1 ; i>=0 && i>=history.size()-5 ; i--) {
- out.println(history.get(i));
- }
- out.close();
- }
- @Override
- public void load() throws Exception {
- history.clear();
- BufferedReader in = new BufferedReader(new FileReader("Calculator.out"));
- String line;
- while ( (line = in.readLine()) != null) {
- history.add(line);
- }
- curIndex = history.size()-1;
- in.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement