Changing a single character in a StringBuffer object : StringBuffer StringBuilder « Development « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Regular Expressions
8. Collections
9. Thread
10. File
11. Generics
12. I18N
13. Swing
14. Swing Event
15. 2D Graphics
16. SWT
17. SWT 2D Graphics
18. Network
19. Database
20. JSP
21. JSTL
22. Servlet
23. Web Services SOA
24. Email
25. J2EE Application
26. XML
27. Design Pattern
28. Log
29. Apache Common
Microsoft Office Word 2007 Tutorial
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
Java Tutorial » Development » StringBuffer StringBuilder 
6. 11. 23. Changing a single character in a StringBuffer object


public class MainClass {

  public static void main(String[] arg) {
    StringBuffer phrase = new StringBuffer("one two three four");

    phrase.setCharAt(3'Z');

    System.out.println(phrase);

  }

}
oneZtwo three four
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
ww_w__.j___a___va_2_s___.c_om__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.