Hi! Why doesnt the StringBuffer Class override the equals() Method it inherits from Object Class? The String Class does, and it's more useful. That leads me to the second question: what are the design choices involved in choosing between String and StringBuffer Strings? I can take no more! My heads spinning, I'm off to admire the surfboards in the arcade. Cheers, Griff
R K Singh
Ranch Hand
Joined: Oct 15, 2001
Posts: 5369
posted
0
StringBuffer are basically String object which are mutable and String objects are immutable imutable means once object is created you can not change the object. Mutable means you can change the contents of object. So when you think your String object is going to be changed more often then it is always best practise to use StringBuffer. As per me it is good that StringBuffer does not have equals() as they(SUN) have to repeat the code. StringBuffer can easily compared by stringBuffObj01.toString().equals(stringBuffObj02.toString())
"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.