Tuesday 1 July 2014

StringBuffer (CharSequence seq)

public StringBuffer(CharSequence seq)
Constructs a string buffer that contains the same characters as the specified CharSequence. The initial capacity of the string buffer is 16 plus the length of the CharSequence argument.

class StringBufferConstructor2{
 public static void main(String args[]){
  StringBuffer str;
  str = new StringBuffer("efghij");
  
  System.out.println("str = " + str);
  System.out.println("Length Of str is " + str.length());
  System.out.println("Initial Capacity is " + str.capacity());
 }
}

Output
str = efghij
Length Of str is 6
Initial Capacity is 22




Prevoius                                                 Next                                                 Home

No comments:

Post a Comment