1. Engineering
  2. Computer Science
  3. please use the above implementation and the code below to...

Question: please use the above implementation and the code below to...

Question details

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 its a better name for the variable int currentCapacity this.elements. length if(this.size <currentCapacity) ( return;h 31 32 33 String1 expanded new String[currentCapacity 21: for(int i-e; į< this.size; İ+ะไ) { 35 36 37 expanded[i] this.elementslil: this.elements expanded; 40 h 41
Please use the above implementation and the code below to answer question #1. Please explain it well.

ArrayStringList months new ArrayStringList0 months.add-January): months.add( February) months.addMarch months.add(Apni months.add May months.addJune) months.add July months.add( August months.addSeptember months.add( October) months.add( November) months.add( December 1. What is the value of months.elements.length after this pon code runs? O 12 O 13 O 16 O 24 32
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution