You can't access a String object as if it were an array.
The String class does offer a method to return a String object's value as a char array, though.
Still, because Strings are immutable you can't just manipulate that array and expect the String object's value to refelct that change accordingly.
So you'd need a way to create a new String object based on the manipulated char array.
Why don't you have a look at the String API and see if you can figure out how to solve this.
Note that there are other ways to go about this.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Read Jelle's posts, because he's absolutely right:
1. You can do it that way.
2. You should read the API for java.lang.String (←click) because you may work out a much better way. (Big hint: substring() is your friend).
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here