Thursday 3 July 2014

append (String str)

public synchronized StringBuffer append(String str)
Appends the specified string to this character sequence.

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

Output
s1 = Value of s2 is str2





Prevoius                                                 Next                                                 Home

No comments:

Post a Comment