java turn array into string code example

Example 1: array to string java

char[] charArray = new char[] {'b','u','z','z'};

String answer = new String(charArray);

Example 2: java srting array to string

Arrays.toString(charArr);

Example 3: list of string to string array in java

list.toArray(new String[0]);

Example 4: turn array into string

const elements = ['Fire', 'Air', 'Water'];

console.log(elements.join());
// expected output: "Fire,Air,Water"

console.log(elements.join(''));
// expected output: "FireAirWater"

console.log(elements.join('-'));
// expected output: "Fire-Air-Water"

Tags: