I’m doing an assignment that requires me to complete the following block of code:
public int[] test(String input) {
return new int[1];
}
I’ve already filled in part of it (I have to manipulate the string). But to return my results in the array, how should I do this? I don’t see a clearly labeled array that I can write to; or can I create the array within the return line?
I could just be missing the point, and have to create my own array to replace the one given (just a thought).
What are the constraints on the assignment? Would it be wrong to declare a local array, such as:
Then you could manipulate
i.If that’s not allowed, then you can do something like: