- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Are there any ways to Manipulate Strings in Java.
Since String class is immutable once created we cannot modify the data of the string. But still, if you want to manipulate string data you can rely on StringBuffer or StringBuilder classes.
Example
public class Test { public static void main(String args[]) { String str = "Hi welcome "; StringBuffer sb= new StringBuffer(str); sb.append("to Tutorialspoint"); System.out.println(sb); } }
Output
Hi welcome to Tutorialspoint
- Related Articles
- Different ways to concatenate Strings in Java
- How many ways are there to register a driver in Java?
- How many ways are there to initialize a final variable in java?
- How many ways are there to convert an Array to ArrayList in Java?
- Are there any other ways I can improve my concentration other than the Rubic Cube?
- How many ways are there to initialize the instance variables of a class in java?
- I find ragi bitter in taste. Are there any ways to consume it such that it does not taste bitter?
- In how many ways we can concatenate Strings in Java?
- How can I check if there are any selected items in Java JList
- Is there any method to convert a Set to immutable in Java
- What are the methods in jQuery to manipulate attributes?
- Are there any special foods to keep your eyes healthy?
- Python - Ways to merge strings into list
- Is there any alternative solution for static constructor in java?
- Is there any alternative for OpenCV imshow() method in Java?

Advertisements