Write a public static method named printArray, that takes two arguments. The first argument is an Array of int and the second argument is a String. The method should print out a list of the values in the array, each separated by the value of the second argument. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; printArray(myArray, ", ") will print out 1, 22, 333, 400, 5005, 9 printArray(myArray, " - ") will print out 1 - 22 - 333 - 400 - 5005 - 9 You may wish to write some additional code to test your method. -------------------------------------------------- // 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 printArray, that takes two arguments. The first argument is an Array of int and the second argument is a String. The method should print out a list of the values in the array, each separated by the value of the second argument.
For example, given the following Array declaration and instantiation:
int[] myArray = {1, 22, 333, 400, 5005, 9};
printArray(myArray, ", ") will print out 1, 22, 333, 400, 5005, 9
printArray(myArray, " - ") will print out 1 - 22 - 333 - 400 - 5005 - 9
You may wish to write some additional code to test your method.
--------------------------------------------------
// 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 2 steps with 1 images