A good answer might be:
Test A: -20 19 1 Test B: Test C: 19 1 5 -1 27 19 5
In "Test B" the method is asked to start with an index of -1.
The test in the In "Test C" the method is asked to print beyond the end of the array, but it quits after it has printed the last element. | ||
Sum MethodHere is the ArrayOps class, again, with a new method. This new method will add up all the elements in an array.
Here is how the method might be used in main():
The declaration of the method says that it expects an array of int as a parameter, and that it will return an int back to the caller when it is done: int sumElements ( int[] nums ) | ||
QUESTION 12:Fill in the blanks of the sumElements() method. Click Here after you have answered the question |