Wednesday 2 July 2014

append (char[] str, int offset, int len)

public synchronized StringBuffer append(char[] str, int offset, int len)
len number of Characters of the char array str, starting at index offset are appended to this string.

class StringBufferAppendCharArray1{
 public static void main(String args[]){
  StringBuffer s1 = new StringBuffer("Value of s1 is ");
  char c[] = {'c', 'h', 'a', 'r'};
  s1.append(c,0,2);
  
  System.out.println(s1);
 }
}

Output

Value of s1 is ch



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment