Lecture 23
19
Class StringBuffer
•Like a String, but with direct access to char contents – therefore mutable
•Much more efficient
•
•StringBuffer buf = new StringBuffer("World");
•buf.insert(0, "Jello, ");
•buf.append("!");
•buf.setCharAt(0,'H'); // now "Hello, World!"
•buf.reverse();        // now "!dlroW ,olleH"
•String s = buf.toString();
•