-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArrayStackTest.java
More file actions
27 lines (23 loc) · 884 Bytes
/
ArrayStackTest.java
File metadata and controls
27 lines (23 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.EmptyStackException;
public class ArrayStackTest
{
public static void main(String[] args){
try{
ResizeableArrayStack<Integer> testStack = new ResizeableArrayStack<>();
System.out.println(testStack.evaluatePostfix("ae+bd-/"));
System.out.println(testStack.evaluatePostfix("abc*d*-"));
System.out.println(testStack.evaluatePostfix("abc-/d*"));
System.out.println(testStack.evaluatePostfix("ebca^*+d-"));
System.out.println(testStack.evaluatePostfix("ab*ca-/de*+"));
}
catch(IllegalStateException ex){
System.out.println(ex.getMessage());
}
catch(SecurityException ex){
System.out.println(ex.getMessage());
}
catch(EmptyStackException ex){
System.out.println("Empty stack");
}
}
}