โ Back to Classes
Question 204
Stackable Interface with Undo History
Stackable Interface with Undo History
Create a classUndoHistorythat implements the providedStackableinterface to track text actions. Requirements: - Use aString[] actionsarray of size 10 and anint topcounter (starts at 0) to track the stack. -push(String item)adds the item at indextopand incrementstop. Ignore if full. -pop()decrementstopand returns the item. Return"empty"if nothing to pop. -peek()returns the item attop - 1without removing it. Return"empty"if stack is empty. Do NOT write a main method.
Expected Output:
Typed B Typed B Typed A empty
Topics:
InterfacesClasses
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.