---
title: "What is the difference between String and String Buffer?"  
description: "What is the difference between String and String Buffer?"  
author: "Pushpendra Singh"  
published: 2010-10-25  
updated: 2020-09-17  
canonical: https://www.mindstick.com/interview/174/what-is-the-difference-between-string-and-string-buffer  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What is the difference between String and String Buffer?

String objects are constants and immutable where as StringBuffer objects are not.StringBuffer Class supports \
growable and modifiable string where as String class supports constant strings. Strings once created we cant \
modify them. Any such attempt will lead to the creation of new strings.String values are resolved at run time where as StringBuffer valuesc are resolved at compile time.So if you know the exact size of the string to be appended it is better to go for String objects.\

## Answers

### Answer by Pushpendra Singh

String objects are constants and immutable where as StringBuffer objects are not.StringBuffer Class supports \
growable and modifiable string where as String class supports constant strings. Strings once created we cant \
modify them. Any such attempt will lead to the creation of new strings.String values are resolved at run time where as StringBuffer valuesc are resolved at compile time.So if you know the exact size of the string to be appended it is better to go for String objects.\


---

Original Source: https://www.mindstick.com/interview/174/what-is-the-difference-between-string-and-string-buffer

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
