Question: 2. Write a method of the ArrayBoundedStack class to swap the item at the bottom of the stack with the item at the top of

2. Write a method of the ArrayBoundedStack class to swap the item at the bottom of the stack with the item at the top of the stack. Do not use any other stack methods in your code. The fields of the ArrayBoundedStack are: protected final int DEFCAP = 100; // default capacity protected T[] stack; // holds stack elements protected int topIndex -1; // index of top element in stack =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
