Sidebar

[line: 198] The choice of Java constructor toString matching JavaScript argument types (object) is ambiguous; ...

0 votes
1.3K views
asked Jul 15, 2013 by rich-c-2789 (16,180 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.
answered Jul 15, 2013 by rich-c-2789 (16,180 points)
selected Dec 17, 2013 by ron-s-6919
...