How to join two or more Strings using the Java String concat() method
Coding River
How to join two or more Strings using the Java String concat() method - Java Tutorial For Absolute Beginners
In this video, we will talk about the Java String concat() method, which will allow us to join two or more Strings and return the combined String. Let me walk you through an example in order to explain further:
String str1 = “www”; String str2 =”codingriver”; String str3 =”com”;
In this example, I want to use the concat() method to join these Strings. And as I said that this method returns a String value So I will declare a String variable that will hold the combined String
String joined_string = str1.concat(“.”).concat(str2).concat(“.”).concat(str3); System.out.println(concatenated_string);
If I run this, I will get "www.codingriver.com" As you can see, my String values have been joined or concatenated. You can also note that this method can be called multiple times in a statement. Thanks for viewing and I hope it has been informative please don’t forget to support by liking this video and also by subscribing to this channel. Let’s meet in the next video.
#codingriver #java #programming ... https://www.youtube.com/watch?v=gndck76KMeU
6982165 Bytes