I know how ot output an array as a string using Arrays.toString(). But then I have to set the method to return as a string.
a) how come when I run this:
public static void main(String[] args){
print(myMethod(new int[]{1, 2, 3, 4}));
}
public static int[] myMethod(int[] nums){
return nums;
}
I get [I@35a8767 ?
I'd like to know what the compiler is doing in the background when it spits that out.
and
b) is there a way to have it output correctly without having to make the method return as a String?