A good answer might be:

Yes, this would work.

StringBuffer

The reversed string could be built up character by character in an array. Since arrays can be changed after construction, only one new object would be constructed. This is essentially the idea of the StringBuffer class.

A StringBuffer object holds a string of characters that can be changed by appending characters at the end and by inserting characters. However, unlike a char array, a StringBuffer comes with many methods convenient for character manipulation. A StringBuffer grows in length as needed. Constructors for StringBuffer are:

StringBuffer constructors
public StringBuffer() create an empty StringBuffer
public StringBuffer(int capacity) create a StringBuffer with initial room for capacity characters
public StringBuffer(String st) create a StringBuffer containing the characters from st

As with arrays, StringBuffer indexes start at 0 and go up to length-1. Some StringBuffer methods are:

StringBuffer methods
StringBuffer append( char c ) append c to the end of the StringBuffer
StringBuffer append( int i ) convert i to characters, then append it to the end of the StringBuffer
StringBuffer append( long l ) convert l to characters, then append it to the end of the StringBuffer
StringBuffer append( float f ) convert f to characters, then append it to the end of the StringBuffer
StringBuffer append( double d ) convert d to characters, then append it to the end of the StringBuffer
int capacity() return the current capacity (capacity will grow as needed).
char charAt( int index) get the character at index i.
StringBuffer insert( int index, char c) insert character c at position i (old characters move over to make room).
StringBuffer insert( int index, String st) insert characters from st starting at position i.
StringBuffer insert( int index, int i) convert i to characters, then insert them starting at position i.
StringBuffer insert( int index, long l) convert l to characters, then insert them starting at position i.
StringBuffer insert( int index, float f) convert f to characters, then insert them starting at position i.
StringBuffer insert( int index, double d) convert d to characters, then insert them starting at position i.
int length() return the number of characters.
StringBuffer reverse() Reverse the order of the characters.
void setCharAt( int index, char c) set the character at index to c.
String toString() return a String object.

QUESTION 5:

Look over the list of methods. Is there a method to delete characters?

Click Here after you have answered the question