Contents

How to convert an array of strings to a string (with.Java)

   Aug 13, 2023     0 min read

In this article, we learned how to convert an array of strings to a string (with.Java).

In preparation for my coding test and to make it job-appropriate, I’m going back to Java, a language for object-oriented coding. In this article, we’re going to cover how to convert an array of strings into a string.

The method is join().

What is join()?

With join() of class String, you can convert an array of strings to a string. join() takes two arguments. The first argument acts as a delimiter for each element when converting the array to a string. The second argument inserts the array of strings to be converted. In this case, the return value is a String.

join() usage example
String[] strArr = {"a","b"};
String str = String.join("",strArr);
System.out.println(str);
// result: ab