Difference between String and String Buffer?

Answers were Sorted based on User's Feedback



Difference between String and String Buffer?..

Answer / janet

1. String objects are constants and immutable where as
StringBuffer objects are not.
2.String class supports constant strings where as
StringBuffer class supports growable and modifiable strings.

Is This Answer Correct ?    13 Yes 0 No

Difference between String and String Buffer?..

Answer / sumati

String is immutable
String buffer is mutable

Ex String str = "abc";
str = "new String";
this will creat new memory location and stores "new String"

but in String buffer
StringBuffer strBuf = "abc";
strBuf = "new String"

it will overwrite in same memory location

Is This Answer Correct ?    13 Yes 0 No

Difference between String and String Buffer?..

Answer / ravikiran(aptech mumbai)

string is immutable
string buffer is mutable

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can we override a variable in java?

0 Answers  


what is diffrence between .NET and java?

2 Answers  


Can we place the any object to key attribute of HashMap<key,value>?

4 Answers   HCL,


Hi Friends, I am new to java. Can u explain about thread concept.How i know one thread is locked, and how can i force or acquire another thread for lock . Finally how to know thread is released from lock. Explain types of lock(like method level and block level) in thread.

1 Answers  


What are the differences between string, stringbuffer and stringbuilder?

0 Answers  






Is char * a string?

0 Answers  


Does java have a compiler?

0 Answers  


What does java edition mean?

0 Answers  


How do you find the maximum number from an array without comparing and sorting?

0 Answers   BlackRock,


Can a constructor have different name than a class name in java?

0 Answers  


What is stop(), suspend(), resume() method?

3 Answers  


how come we know the object is no more used in the class?

2 Answers   Accenture,


Categories