Thursday, 31 March 2016

Java Tutorial : Java String Concatenation


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

Click the below Image to Enlarge
Java Tutorial : Java String Concatenation 
ConcatenationDemo1.java
public class ConcatenationDemo1
{

    public static void main(String[] args)
    {
        /*
         * String concatenation operator produces a new
         * string by appending the second operand onto the
         * end of the first operand.
         */
        String string1 = "Hello" + " World";
        System.out.println(string1);// Hello World

        /*
         * The string concatenation operator can concat not
         * only string but primitive values also.
         */
        String string2 = 50 + 30 + "Hello" + 40 + 40;
        System.out.println(string2);// 80Sachin4040

    }
}
Output
Hello World
80Hello4040
ConcatenationDemo2.java
public class ConcatenationDemo2
{

    public static void main(String[] args)
    {
        String s1 = "Sachin ";  
        String s2 = "Tendulkar";
        String s3 = s1.concat(s2);
        System.out.println(s3);// Sachin Tendulkar

    }

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

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/12836b6e32056aa84ee5263036ba2429cc0bd845/BasicJava/StringDemo_Concatination_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

    Google+ Followers

    Google+ Badge