Question: Given the following class declaration: public class MyList { private String [ ] list; private int numItems; / * * Creates an empty list with

Given the following class declaration:
public class MyList
{
private String[] list;
private int numItems;
/**
Creates an empty list with the given capacity
*/
public MyList(int capacity)
{
list = new String[capacity];
numItems =0;
}
/**
Attempts to add an item to the next open spot in the list.
Returns false if the list is full.
*/
public boolean addItem(String item)
{
// YOUR CODE HERE
}
}
Which of the the following is a correct implementation of the addItem method?

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!