void setCharAt (int index, char ch) : This method sets the character at the specified index in the string buffer to the new character ch. For example, s1. setCharAt (6, ‘J’) will return Hello Java.
public class StringBuffersetCharAt
{
public static void main(String[] args)
{
StringBuffer sl = new StringBuffer("Hello java");
sl.setCharAt(6,'J');
System.out.println("sl.setCharAt(6,'J') : " + sl);
}
}