Java Stringjoin() Method
Example
Join strings with a space between them:
String fruits = String.join(" ", "Orange", "Apple", "Mango");System.out.println(fruits);Definition and Usage
Thejoin() method joins one or more strings with a specified separator.
Syntax
One of the following:
public String join(CharSequenceseparator, CharSequence...elements)public String join(CharSequenceseparator, Iterableelements)Parameter Values
| Parameter | Description |
|---|---|
| separator | Required. The separator used to join the elements |
| elements | Required. Elements to be joined |
Technical Details
| Returns: | A newString, separated by the specified separator |
|---|---|
| Java version: | 1.8 |
❮ String Methods

