Write a public static method named printArrayList, that takes two arguments. The first argument is an ArrayList of Integerand the second argument is a String. The method should print out a list of the values in the ArrayList, each separated by the value of the second argument. For example, given an ArrayList of Integer named myList, that currently stores these values: {1, 22, 333, 400, 5005, 9} printArrayList(myArray, ", ") will print out 1, 22, 333, 400, 5005, 9 printArrayList(myArray, " - ") will print out 1 - 22 - 333 - 400 - 5005 - 9 ---------------------------------------------------------- // import any necessary packages here below public class Main { public static void main(String[] args) { // write any code to test you method(s) here below } // define your method(s) here below }
Write a public static method named printArrayList, that takes two arguments. The first argument is an ArrayList of Integerand the second argument is a String. The method should print out a list of the values in the ArrayList, each separated by the value of the second argument.
For example, given an ArrayList of Integer named myList, that currently stores these values: {1, 22, 333, 400, 5005, 9}
printArrayList(myArray, ", ") will print out 1, 22, 333, 400, 5005, 9
printArrayList(myArray, " - ") will print out 1 - 22 - 333 - 400 - 5005 - 9
----------------------------------------------------------
// import any necessary packages here below
public class Main {
public static void main(String[] args) {
// write any code to test you method(s) here below
}
// define your method(s) here below
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images