Problem scenario
You are trying to print out a multi-dimensional array in Java. When you try to compile your program, you get this:
error: no suitable method found for toString(String)
System.out.println(Arrays.toString(Arrays.toString(var1)));
^
method Arrays.toString(long[]) is not applicable
(argument mismatch; String cannot be converted to long[])
What should you do?
Solution
You need to pass a one-dimensional array to Arrays.toString in the System.out.println statement.
…
Continue reading “How Do You Troubleshoot “error: no suitable method found for toString(String)”?”