Thursday, 3 July 2014

append (StringBuffer sb)

public synchronized StringBuffer append(StringBuffer sb)
Appends the specified StringBuffer to this sequence. If sb is null, then the four characters "null" are appended to this StringBuffer.

public class StringBufferAppendStringBuffer {
    public static void main(String args[]){
        StringBuffer s1 = new StringBuffer("Value of s2 is ");
        StringBuffer s2 = new StringBuffer("str2");
        
        s1.append(s2);
        
        System.out.println("s1 = " + s1);
    } 
}

Output
s1 = Value of s2 is str2




Prevoius                                                 Next                                                 Home

No comments:

Post a Comment