Question: public static void print(int[] arr) { // Always check for null references first! if (arr null) { } } == } throw new IllegalArgumentException();

public static void print(int[] arr) { // Always check for null references

public static void print(int[] arr) { // Always check for null references first! if (arr null) { } } == } throw new IllegalArgumentException(); for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); 1. (5 points) In the appropriate section of ps3_partI (see above), rewrite this method so that it uses recursion instead of iteration. You will need to add a second parameter (call it start) that keeps track of where you are in the array. More precisely, start will specify the start of the portion of the array that the current call is focused on. For example, to print the entire array arr, a client would make the call print(arr, 0). To print the portion of the array that begins at position 3, a client would make the call print(arr, 3). If start is negative, the method should throw an IllegalArgumentException. If start is too big given the length of the array, the method should simply return without printing anything.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Base case If the start index is negative or greater than or equal to the length of the array the method returns without printing anything Recursive ca... View full answer

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 Programming Questions!