The join method joins strings with a specified separator between them.
String fruits = String.join(" ", "Pear", "Banana", "Strawberry");
System.out.println(fruits);
// "Pear Banana Strawberry"
The join method joins strings with a specified separator between them.
String fruits = String.join(" ", "Pear", "Banana", "Strawberry");
System.out.println(fruits);
// "Pear Banana Strawberry"