# Joining Strings with Java 1.8+

The static String's method join,
introduced in Java 1.8, joins a String array with a passed separator:


import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;

public class StringJoinTest {
    @Test
    public void joinStrings() {
        var commaSeparated = String.join(",", "hello", "world");
        assertEquals("hello,world", commaSeparated);
    }
}
