So I was trying to print an array of ints in my program, and following these instructions What's the simplest way to print a Java array?
wrote the following code:
int[] totals = //method that returns int array
System.out.println(Arrays.toString(totals));
But it wont compile saying that
"method toString in class Object cannot be applied to given types. required: no arguments found: int[] reason: actual and formal argument list differ in length"
Why does it do that? Do I not pass my array as an argument to toString? If not, how do I use toString?
Thank you!