string concatenation code example
Example 1: String concatenation in java
public class StringConcatMethodDemo
{
public static void main(String[] args)
{
String str1 = "Flower ";
String str2 = "Brackets";
String str3 = str1.concat(str2);
System.out.println(str3);
}
}
Example 2: string concatenation in js
var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
console.log(res);
Example 3: concatenation
the process of adding strings / chars together to make a larger string
ie:
String str = "cat";
Char letter = 's';
String newWord = str + letter;
==> newWord == "cats"
Example 4: python concatenate strings
x = ‘apples’
y = ‘lemons’
z = “In the basket are %s and %s” % (x,y)
Example 5: how add strings together
String firstName = "BarackObama";
String lastName = " Care";
System.out.println(firstName + lastName);
String name = firstName + lastName;
System.out.println(name);
System.out.println("BarackObama" + " Care");
Example 6: string concatenation in python
x="String"
y="Python"
d="+"
c = "We can concatenation " + y + x + "with" + d + "Operator"
print(c)