X1366: ArrayStack - Constructor

In this first problem, you will declare the instance variable named 'stack' of type ArrayList<E>. YOU MUST use the name stack for this instance variable. In the constructor, instantiate the stack by creating a new ArrayList<E>. The clear() method should just (re)create a new stack as a way to initialize it. You can assume the class definition is there for you:

import itsc2214.*;
public class ArrayStack<E> implements StackADT<E> {
 // code for the problems goes here
}

You might want to look at the documentation for ArrayList to refresh your memory of how to use that class.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.