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 //this is my class name

private E[] navStack; //and this is my stack

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!