-
Notifications
You must be signed in to change notification settings - Fork 4
Joining Strings using String.join() Example
Ramesh Fadatare edited this page Jul 11, 2019
·
1 revision
In this Java example, we join strings with the String.join() method.
public class Java8StringJoinExample {
public static void main(String[] args) {
String join = String.join("/", "2019", "07", "11");
System.out.println(join);
}
}
Output:
2019/07/11
The String.join() method internally uses the StringJoiner.
A date is concatenated with the String.join() method:
String join = String.join("/", "2019", "07", "11");