question about string

i know strings are immutable which means once constructed they cannot be changed. So i thought to write a program to replace a word in a string with another word specified. here is my program

publicclass ReplacingString{

publicstaticvoid main(String[] args){

replaceWord("To be or not to be, that is the question","be","see");

}

staticvoid replaceWord(String doc, String target, String replace){

//StringBuffer document = new StringBuffer(doc);

String word = doc.replaceAll(target, replace);

System.out.println(word);

}

}

Simple and easy. but i had to create another String word and then print it out though it does not matter to me at all but was curious if i can do the same thing with StringBuffer? i saw the api docs, they have only replace method not replaceAll. is there any way i can write the same program with StringBuffer?

[1406 byte] By [schumachera] at [2007-11-27 8:40:14]
# 1
What you see is what you get. If StringBuffer doesn't have a replaceAll method, then you can't do the exact same thing.
jverda at 2007-7-12 20:38:36 > top of Java-index,Java Essentials,New To Java...
# 2
Thanks for the clarification jverd
schumachera at 2007-7-12 20:38:36 > top of Java-index,Java Essentials,New To Java...