Write a static recursive method that returns the sum of the integers in the array of int values passed to it as a single argument. You can assume that every indexed variable of the array has a value. Embed the method in a test program.
The insight for this problem is to realize that the array passed each iteration must be diminished by one element and the base case is when the passed array has just one element. In order to pass a diminished array, another, temporary, array must be created that is a copy of all but the highest-index value of the passed array. The return value should be the sum of the value at the highest-index of the passed array plus the return value from the call to sumOfInts.
See the code in SumOfIntsDemo.java.
You might also like to view...
An older hard drive that is suspect should be formatted with a quick format as part of the Windows installation process so that further damage is not incurred as a result of the strenuous tests performed as part of a full format
Indicate whether the statement is true or false
A macro enables you to automate repetitive tasks by ________ the steps that you take to accomplish them
Fill in the blank(s) with correct word