Advertisement
String s1= new String("Hello"); //Statement1
String s2= new String("World"); //Statement2
s1= s1.concat(s2); //Statement3
StringBuffer s1= new StringBuffer("Hello"); // Statement1
StringBuffer s2= new StringBuffer("World"); // Statement2
s1.append(s2); // Statement3
Advertisement
// StringBuffer Class Example
class StringBufferEx
{
public static void main(String... ar)
{
StringBuffer sb= new StringBuffer("Keep");
System.out.println("Original String is : "+ sb);
sb.append("Learning");
System.out.println("Modified String is : "+ sb);
}
}
Original String is : Blue
Modified String is : BlueSky
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement