String
String objects are immutable, which means that once they are created they cannot be changed. When we use one of the methods of the String class, we create a new string object.
Here concatenation is used to combine two strings.
String object is used to concatenate two strings.
The first string is combined to the other string by creating a new copy in the memory as a string object, and then the old string is deleted
Less efficient
String Builder
StringBuilder are mutable class, which means when concatenate any text to the variable it allows us to modify the original value without creating a new object.
Here Append method is used.
Stringbuilder object is used.
Insertion is done on the existing string.
StringBuilder is more efficient for large amounts of string manipulations