deleteCharAt( ) method when used with StringBuffer deletes a character from the StringBuffer's object at the provided index.
StringBuffer object1 = new StringBuffer("ABCZDEF");
object1.deleteChatAt(3); -> Deletes the character available at index 3 i.e. Z in "ABCZDEF"
Lets implement this on Eclipse IDE:
1. Create 'deleteChatAt' class under any project as shown below:
2. Save and Run the 'deleteChatAt' class file
3. Observe that the output is displayed in the console as shown below:
Download this project:
Click here to download the project containing the class file used in this post (You can download this project and import into Eclipse IDE on your machine)
Please comment below to feedback or ask questions.
Using 'replace( )' method with StringBuffer will be explained in the next post.