Share via


StringBuffer.StringBuffer

Class Overview | Class Members | This Package | All Packages

Syntax 1

public StringBuffer()

Description

Constructs a string buffer with no characters in it and an initial capacity of 16 characters.

Syntax 2

public StringBuffer( int length )

Parameters
  • length
    the initial capacity.
Description

Constructs a string buffer with no characters in it and an initial capacity specified by the length argument.

Exceptions

NegativeArraySizeException if the length argument is less than 0.

Syntax 3

public StringBuffer( String str )

Parameters
  • str
    the initial contents of the buffer.
Description

Constructs a string buffer so that it represents the same sequence of characters as the string argument. The initial capacity of the string buffer is 16 plus the length of the string argument.