Assign Variable, here you have to assign variable to method that is returning same type so… String[] xx = function String[]()
In your case:
String[] num = numbers();
The method here you have to create array, fill it and return it. Always according to it’s signature so if you declare a function String[] name()
you must return String[]
to finish function.
In your case:
public String[] numbers(){
String[] numbers = new String[20];
for (int i = 0; i<20; i++){
numbers[i] = Integer.toString(i); // i is an integer, "transform it into string"
}
return numbers;
}
solved Returning a String array and assign it to a String array type variable in Java