How to convert array to String in Java?

To convert array to String in Java, use Arrays.toString.

Here's how you do it:

var array = new String[] { "Hello", "World", "!" };

String stringFromArray = java.util.Arrays.toString(array);

// [Hello, World, !]
System.out.println(stringFromArray);