Constructors of StringBuffer Class in Java



Following are the various constructors provided by the StringBuffer class.

S.N.
Constructor & Description
1 StringBuffer()
This constructs a string buffer with no characters in it and an initial capacity of 16 characters.
2 StringBuffer(CharSequence seq)
This constructs a string buffer that contains the same characters as the specified CharSequence.
3 StringBuffer(int capacity)
This constructs a string buffer with no characters in it and the specified initial capacity.
4 StringBuffer(String str)
This constructs a string buffer initialized to the contents of the specified string.
Updated on: 2019-07-30T22:30:21+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements