20.13
java.lang.StringBuffer
THE PACKAGE JAVA.LANG
20.13.1
public StringBuffer()
This constructor initializes a newly created
StringBuffer
 object so that it ini 
tially represents an empty character sequence and has capacity 16.
20.13.2
public StringBuffer(int length)
throws NegativeArraySizeException
This constructor initializes a newly created
StringBuffer
 object so that it ini 
tially represents an empty character sequence, but has the capacity specified by
the argument.
If the argument is negative, a
NegativeArraySizeException
 is thrown.
20.13.3
public StringBuffer(String str)
This constructor initializes a newly created
StringBuffer
 object so that it repre 
sents the same sequence of characters as the argument; in other words, the initial
contents of the string buffer is a copy of the argument string. The initial capacity
of the string buffer is 16 plus the length of the argument string.
20.13.4
public String toString()
A new
String
 object is created and initialized to contain the character sequence
currently represented by the string buffer; the new
String
 is then returned. Any
subsequent changes to the string buffer do not affect the contents of the returned
string.
Implementation advice: This method can be coded so as to create a new
String
 object without allocating new memory to hold a copy of the character
sequence. Instead, the string can share the memory used by the string buffer. Any
subsequent operation that alters the content or capacity of the string buffer must
then make a copy of the internal buffer at that time. This strategy is effective for
reducing the amount of memory allocated by a string concatenation operation
( 15.17.1) when it is implemented using a string buffer.
Overrides the
toString
 method of
Object
 ( 20.1.2).
20.13.5
public int length()
This method returns the length of the sequence of characters currently represented
by this
StringBuffer
 object.
550






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved