Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Java StringJoiner Class in Java 8



This class is used Join a sequence of characters separating using the delimiter.

Example

public class StringJoinerSample {
   public static void main(String[] args){
      StringJoiner sj = new StringJoiner(", ");
      sj.add("Krishna");
      sj.add("Raju");
      sj.add("Satish");
      sj.add("Pruthvi");
      System.out.println(sj);
   }
}

Output

Krishna, Raju, Satish, Pruthvi
Updated on: 2020-06-29T15:00:44+05:30

130 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements