Hey!
The the code that i have must be able to, via a method, take an array of numbers and make them into a string and then return to print them out.
There is two parts of this code so far (two methods other than the main).
The first method adds numbers in an array and prints out the sum and it works fine.
But the second one, aka the string one, doesn't work.
Any tips?
public static void main(String[] args) { // First part! int[] Array = { 3, 4, 5, 6, 7 }; int hellfire = sum(Array); System.out.println(hellfire); // Second part... System.out.println(toString()); } //Works! public static int sum(int[] Array) { int n = 0; for (int i : Array) { n += i; } return n; } //Can't get it to do anything.. public static String toString(int[] k) { int[] n = { 3, 4, 5, 6, 7 }; String str = Arrays.toString(n); System.out.println("n = " + str); return str; } }