Question: I am confused about my current project. It is about the array. The capacity of it is fixed, and we need to put the new
I am confused about my current project. It is about the array. The capacity of it is fixed, and we need to put the new items into it. If the current number of items larger than the capacity, for example, the capacity is 5, and the current array is [1,2,3,4,5], we want to put new item 6. The array should change to [2,3,4,5,6]. I complete the toString part.
However, my code print nothing.

Here is my insert part.

It is the test:

My result:

Another test:
![is [1,2,3,4,5], we want to put new item 6. The array should](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f958211a383_05666f95820888b2.jpg)
![change to [2,3,4,5,6]. I complete the toString part. However, my code print](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f95821c5085_05766f958216f349.jpg)
3 import java.util.Iterator; 4 5 public class Bag
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
