CJCoding With Joseph
15free / daySign inCreate account

Is the Array Stack Empty or Full?

push, pop and peek all lean on two tiny status methods, and both of them are missing. Remember that top is an index, so the highest legal index is one less than the capacity.

Requirements:
1. Complete isEmpty() so it is true only when nothing has been pushed.
2. Complete isFull() so it is true only when every slot up to MAX_SIZE is used.
3. Use the MAX_SIZE constant, not the number 5.

Do NOT write a main method.

Expected Output:

true
false
false
true
false

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Data Structures & AlgorithmsStacks
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.