Write the definition of a method reverse , whose parameter is an array of integers. The method reverses the elements of the array. The method does not return a value.
My code:
public void reverse(int [] arr)
{
String store = "";
for (int i = arr.length-1; i>=0; i--)
{
store += arr[i];
}
System.out.print(store);
}
2006-10-18
09:54:59
·
4 answers
·
asked by
?
1
in
Computers & Internet
➔ Programming & Design
If you pass an array of integers arr1 containing the values 2, 4, 6, 8, 10 to reverse, and print out the array after that, the output will be
10, 8, 6, 4, 2
2006-10-18
10:15:04 ·
update #1
it says that I dont have the correct output
2006-10-18
13:41:12 ·
update #2