Question: Complete the method below. The method should create and return an array double in size that holds the same initial contents plus empty spaces. For
Complete the method below. The method should create and return an array double in size that holds the same initial contents plus empty spaces.
For example, as a result of invoking the method with the words array, words will refer to an array that holds 6 Strings- "a", "b", "c" and then three empty spaces (nulls).
String[] words!- ("a", "b", "c"); words1 - copyAndExpand(words1); /I words1 now holds {"a", "b", "c", null, null, null) String[] words2 - new String[1]; words2te] - "h" words2-copyAndExpand (words2) // words2 now holds ("hi", null) public static String[] copyAndExpand (String[] array) [ /YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
