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 |
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 } }
Hello World 80Hello4040
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 } }
Sachin Tendulkar
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: