ArrayList <Integer> as parameter ...?
I would like to know how to create a method that takes an ArrayList from integers (ArrayList) as a parameter and then displays the contents of an ArrayList?
I have some code that generates some random numbers and populates an ArrayList with results, however when I try to create this particular method I save errors in the eclipse.
Here is what I still have:
public void showArray(ArrayList<Integer> array){
return;
}
I know that it is very simple, but I don’t know exactly how to approach it - could it be something like the following?
public void showArray(ArrayList<Integer> array){
Arrays.toString(array);
}
Any help would be greatly appreciated.
Thank.
+3
4 answers