Revise the GenericStack class in Listing 19.1 to implement it using an array rather than an ArrayList.

Question:

Revise the GenericStack class in Listing 19.1 to implement it using an array rather than an ArrayList. You should check the array size before adding a new element to the stack. If the array is full, create a new array that doubles the current array size and copy the elements from the current array to the new array.

Listing

image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: