Difference between String and String Buffer?
Answers were Sorted based on User's Feedback
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 |
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 |
Answer / ravikiran(aptech mumbai)
string is immutable
string buffer is mutable
Is This Answer Correct ? | 7 Yes | 0 No |
Can we override a variable in java?
what is diffrence between .NET and java?
Can we place the any object to key attribute of HashMap<key,value>?
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.
What are the differences between string, stringbuffer and stringbuilder?
Is char * a string?
Does java have a compiler?
What does java edition mean?
How do you find the maximum number from an array without comparing and sorting?
Can a constructor have different name than a class name in java?
What is stop(), suspend(), resume() method?
how come we know the object is no more used in the class?