1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
1.6K views
by rich-c-2789 (17.6k points)
I get the following error when trying to convert an array to a string using Arrays.toString().  What causes it?

 [line: 198] The choice of Java constructor toString matching JavaScript argument types (object) is ambiguous; candidate constructors are:
 class java.lang.String toString(double[])
 class java.lang.String toString(float[])
 class java.lang.String toString(boolean[])
 class java.lang.String toString(java.lang.Object[])
 class java.lang.String toString(long[])
 class java.lang.String toString(int[])
 class java.lang.String toString(short[])
 class java.lang.String toString(char[])
 class java.lang.String toString(byte[]) in at line number 198

1 Answer

0 votes
 
Best answer
Arrays.toString() only works with Java arrays.  The array that you passed to this method is possibly a JavaScript array, a java.util.ArrayList, or some other object.  Also see the related question linked to this question for an example.
by rich-c-2789 (17.6k points)
selected by ron-s-6919
...