public
StringBuffer (String str)
Constructs
a string buffer initialized to the contents of the specified string.
The initial capacity of the string buffer is 16 plus the length of
the string argument.
class StringBufferConstructor4{ public static void main(String args[]){ StringBuffer str; String s1 = "efghij"; str = new StringBuffer(s1); 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
No comments:
Post a Comment