touque.ca > Education Commons > Java > Code

StackTester output

> run StackTester
01: Stack[capacity: 5, size: 0]
02: full? false
03: empty? true
04: just popped ''
05: peek at ''
06: Stack[capacity: 5, size: 1, 1:a]
07: Stack[capacity: 5, size: 2, 1:a, 2:b]
08: Stack[capacity: 5, size: 3, 1:a, 2:b, 3:c]
09: just popped 'c'
10: Stack[capacity: 5, size: 2, 1:a, 2:b]
11: Stack[capacity: 5, size: 3, 1:a, 2:b, 3:d]
12: Stack[capacity: 5, size: 4, 1:a, 2:b, 3:d, 4:e]
13: peek at 'e'
14: Stack[capacity: 5, size: 5, 1:a, 2:b, 3:d, 4:e, 5:f]
15: full? true
16: empty? false
17: Stack[capacity: 5, size: 5, 1:a, 2:b, 3:d, 4:e, 5:f]
18: just popped 'f'; size now 4
19: just popped 'e'; size now 3
20: just popped 'd'; size now 2
21: just popped 'b'; size now 1
22: just popped 'a'; size now 0
23: just popped ''
24: peek at ''
>

touque.ca > Education Commons > Java > Code

[This page last updated 2020-12-23 at 12h10 Toronto local time.]