Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Can anyone tell me what’s the difference between String and StringBuffer in Java and the maximum size of the String?

1 Answer

0 votes
by (19.7k points)

String : It helps you to manipulate character strings which are immutable. 

StringBuffer: It’s to represent characters which can be modified. 

You can get the maximum size of these two by Integer.MAX_VALUE (231 - 1 = 2,147,483,647) or you can divide maximum heap size by 2. 

Interested in Java? Check out this Java Certification by Intellipaat.   

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...