Question: I want to use an array representation for a generic stack, but code like the following will not compile. What is the problem? [text {
I want to use an array representation for a generic stack, but code like the following will not compile. What is the problem?
\[\text { private Item[] item = new Item[capacity]; }\]
Step by Step Solution
3.45 Rating (148 Votes )
There are 3 Steps involved in it
The problem youre encountering is due to the way Java handles generic arrays In Java you cannot dire... View full answer
Get step-by-step solutions from verified subject matter experts
