Constructors of StringBuilder class in Java.

Java 8Object Oriented ProgrammingProgramming

The StringBuilder class of the java.lang package is a mutable sequence of characters. This provides an API compatible with StringBuffer, but with no guarantee of synchronization. Following are the list of constructors provided by the StringBuilder class.

S.N.
Constructor & Description
1StringBuilder()
This constructs a string builder with no characters in it and an initial capacity of 16 characters.
2StringBuilder(CharSequence seq)
This constructs a string builder that contains the same characters as the specified CharSequence.
3StringBuilder(int capacity)
This constructs a string builder with no characters in it and an initial capacity specified by the capacity argument.
4StringBuilder(String str)
This constructs a string builder initialized to the contents of the specified string.
raja
Published on 12-Feb-2018 08:31:29
Advertisements