Java: Converting a set to an array for String representation

The code works fine.

Replace:

System.out.println(array);

With:

System.out.println(Arrays.toString(array));

Output:

[b, c, a]
[b, c, a]

The String representation of an array displays the a “textual representation” of the array, obtained by Object.toString — which is the class name and the hash code of the array as a hexidecimal string.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)