Closing scanners.

This commit is contained in:
Hassan
2020-01-28 18:34:52 +02:00
parent 4f45c5a479
commit a1f59c38b1
27 changed files with 29 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ public class StackPostfixNotation {
Scanner scanner = new Scanner(System.in);
String post = scanner.nextLine(); // Takes input with spaces in between eg. "1 21 +"
System.out.println(postfixEvaluate(post));
scanner.close();
}
// Evaluates the given postfix expression string and returns the result.
@@ -35,6 +36,7 @@ public class StackPostfixNotation {
// "+", "-", "*", "/"
}
}
tokens.close();
return s.pop();
}
}