Wednesday, 2 July 2014

append (CharSequence s)

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

class StringBufferAppendCharSequence{
 public static void main(String args[]){
  StringBuffer s1 = new StringBuffer("Value of s1 is ");
  StringBuffer s2 = new StringBuffer("Value of s2 is ");
  CharSequence c1 = "wxyz";
  CharSequence c2 = null;
  
  s1.append(c1);
  s2.append(c2);
  
  System.out.println(s1);
  System.out.println(s2);
 }
}

Output
Value of s1 is wxyz
Value of s2 is null




Prevoius                                                 Next                                                 Home

No comments:

Post a Comment