Question: Java The class IntList as defined below stores a list of integers using an internal array. Implement the method add so that it can add

Java The class IntList as defined below stores a list of integers using an internal array. Implement the method add so that it can add any number of integers to the list by automatically doubling the size of the internal array when it becomes full.

class IntList { private int[] a; // internal array to store integers private int length = 0; // size of the list 
 IntList() { a = new int[10]; } // initial size of the array is 10 
 // add integer x to the list and double array size as necessary void add(int x) { 

// TODO }

}

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!