Question: How can I do this in java? DynamicNavStack(int cap): This constructor takes as an argument the initial capacity of the array and allocates memory for
How can I do this in java?
- DynamicNavStack(int cap): This constructor takes as an argument the initial capacity of the array and allocates memory for that array. If the argument is either 0 or a negative integer, set the initial capacity of the array to the default capacity (=2). Other member variables are assigned as appropriate.
- DynamicNavStack(): This constructor should use the other constructor with an initial capacity set to default value(=2).
public class DynamicNavStack
private E[] navStack; //and this is my stack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
