Javatpoint Logo
Javatpoint Logo

Java String join()

The java string join() method returns a string joined with given delimiter. In string join method, delimiter is copied for each elements.

In case of null element, "null" is added. The join() method is included in java string since JDK 1.8.

There are two types of join() methods in java string.


Signature

The signature or syntax of string join method is given below:


Parameters

delimiter : char value to be added with each element

elements : char value to be attached with delimiter


Returns

joined string with delimiter


Throws

NullPointerException if element or delimiter is null.


Since

1.8


Java String join() method example

Test it Now
welcome-to-javatpoint

Java String join() Method Example 2

We can use delimeter to format the string as we did in the below example to show date and time.

25/06/2018 12:10:10




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA