Creating a StringBuffer object with a specific value for the capacity : StringBuffer StringBuilder « Development « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Reflection
8. Regular Expressions
9. Collections
10. Thread
11. File
12. Generics
13. I18N
14. Swing
15. Swing Event
16. 2D Graphics
17. SWT
18. SWT 2D Graphics
19. Network
20. Database
21. JSP
22. JSTL
23. Servlet
24. Web Services SOA
25. Email
26. J2ME
27. J2EE Application
28. XML
29. Design Pattern
30. Log
31. Security
32. Apache Common
Java
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Tutorial » Development » StringBuffer StringBuilder 
6. 11. 4. Creating a StringBuffer object with a specific value for the capacity
public class MainClass {

  public static void main(String[] arg) {
    StringBuffer newString = new StringBuffer(50);
    
    System.out.println(newString.capacity());
  }

}
50
6. 11. StringBuffer StringBuilder
6. 11. 1. StringBuffer and StringBuilder
6. 11. 2. You can also create a StringBuffer object using a reference stored in a variable of type String:
6. 11. 3. Creating a String Object From a StringBuffer Object
6. 11. 4. Creating a StringBuffer object with a specific value for the capacity
6. 11. 5. Adding String to a StringBuffer Object
6. 11. 6. The append() method returns a reference to the extended StringBuffer object
6. 11. 7. Calling append() method to construct a StringBuffer object
6. 11. 8. Appending a Substring: append part of the aString object to the buf object
6. 11. 9. Appending Basic Types: long, double
6. 11. 10. Appending a subset of the elements from a char array
6. 11. 11. StringBuffer methods charAt, setCharAt, getChars and reverse
6. 11. 12. StringBuffer methods insert, delete and deleteCharAt
6. 11. 13. Convert digit to character with Character.forDigit
6. 11. 14. Inserting Strings
6. 11. 15. The Length of a StringBuffer Object
6. 11. 16. Changing the StringBufer Length for a StringBuffer Object
6. 11. 17. To find out a StringBuffer object's capacity
6. 11. 18. The ensureCapacity() method changes the default capacity of a StringBuffer object
6. 11. 19. Finding the Position of a Substring
6. 11. 20. Specifying the index position in the buffer where the search is to start
6. 11. 21. Replacing a Substring in the Buffer
6. 11. 22. Extracting Characters From a Mutable String: charAt() and getChars() methods
6. 11. 23. Changing a single character in a StringBuffer object
6. 11. 24. Using the deleteCharAt() method to remove a character from a StringBuffer object at the index position
6. 11. 25. Removing several characters from a StringBuffer object
6. 11. 26. Reversing the sequence of characters in a StringBuffer object with the reverse() method
w_w___w_.___ja___v_a2__s__.___c__om_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.