Question: In java Method #3 Write a method, createAndFillArray, that receives a String and a size (size must be in 1-1000 range). The method creates an
In java
Method #3 Write a method, createAndFillArray, that receives a String and a size (size must be in 1-1000 range). The method creates an array of String of the received size and populates every element with the received String value. If received size is out of range, the method returns null. method signature: public static String [] createAndFillArray(String str, int size) // example: // String towns 1 = ArrayExamples.createAndFillArray("Austin", 4); // after call towns = ["Austin", "Austin", "Austin", "Austin") Method #4 Write a method, swapArrayValues, that receives an array of ints and 2 indexes, swaps values in the array that are located at the received indexes. For example list = [12, 35, 271(3 values stored as show in indexes 0, 1, 2) ArrayExamples.swapArrayValues(list, O, 1); // should swap values at index 0 and 1 list after call = [35, 12, 27] if either received index is OUT OF RANGE, method does NOTHING. out of range means the received index is not within the array boundaries. 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
