Stack<E>[] stacks = {new Stack<Bed>(), new Stack<Bookshelves>(), new Stack<Chair>(), new Stack<Desk>(), new Stack<Table>()}; For class I had to make my own Stack class that takes in whatever object I specify. As per specification, I have to put all the Stacks into an array.
But, when I try to create an Array of Stacks, I get a "cannot find symbol: class E" error.
What can I do to create an array of generic stacks?
ListofStacks. (Although for your particular case, I frankly think you shouldn't create an array or list at all, but should keep the lists of the different types as explicit, separate variables.)