Wednesday 30 March 2016

Java Tutorial : Java String [join(CharSequence delimiter,CharSequence... elements) method]


Click here to watch in Youtube :
https://www.youtube.com/watch?v=vjUPeAaUV1k&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java String [join(CharSequence delimiter,CharSequence... elements) method] 
JoinDemo.java
/*
 * public static String join(CharSequence delimiter,
 *                              CharSequence... elements)
 * 
 * Parameters: 
 * ----------- 
 * delimiter - the delimiter that separates each element
 * 
 * elements - the elements to join together.
 * 
 * Returns: 
 * -------- 
 * a new String that is composed of the elements
 * separated by the delimiter.
 * 
 * Throws: 
 * ------- 
 * NullPointerException - If delimiter or elements is
 * null
 */

public class JoinDemo
{
    public static void main(String[] args)
    {
        String str1 = "welcome";
        String str2 = "to";
        String str3 = "India";

        String joinString = String.join("_", str1, str2, str3);
        System.out.println("JoinString = " + joinString);

    }

}
Output
JoinString = welcome_to_India
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_join_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_join_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/89dfdef018d2970576505c9f498b5e4f28628c35/BasicJava/StringDemo_join_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment