VOOZH about

URL: https://www.geeksforgeeks.org/java/java-string-join-examples/

⇱ Java String join() with examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java String join() with examples

Last Updated : 8 Apr, 2025

The java.lang.string.join() method concatenates the given elements with the delimiter and returns the concatenated string.Note that if an element is null, then 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. :

public static String join(CharSequence deli, CharSequence... ele) 
and
public static String join
(CharSequence deli, Iterable<? extends CharSequence> ele)
Parameters:
deli- delimiter to be attached with each element
ele- string or char to be attached with delimiter
Returns : string joined with delimiter.

Output
Four < Five < Six < Seven



Output
My name is Niraj Pandey



Output
Wake up-> Eat-> Play-> Sleep-> Wake up


Comment