Question: Please use the above implementation and the code below to answer question #1. Please explain it well. 1 public class ArrayStringList implements Stringlist f 3
1 public class ArrayStringList implements Stringlist f 3 Stringtl elements; 4 int size; 6 public ArrayStringlist O this.elements new String[21: this.size; 10 11 12 13 14 15 16 public void add(String s) expandCapacity) this.elements[this.size]-s; this.size 1; 17 public String get(int index) 18 19 20 21 /I TODO: Check for out-of-bounds // throw IndexOutOfBoundsException return this.elements [index]; 23 public int size) ( 24 25 26 return this.size; 27 private void expandCapacity) /I NOTE(joe): I changed currentsize to currentCapacity below // because it's a better name for the variable int currentCapacity this.elements. length if(this.size
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
