setCharAt
void setCharAt(int index, char ch)
- The character at the specified index is set to ch.
public class Main {
public static void main(String[] argv) {
StringBuilder sb = new StringBuilder();
sb.append("java2s.com");
sb.setCharAt(0, 'J');
System.out.println(sb.toString());
}
}
The output:
Java2s.com