Java StringBuffer setCharAt(int index, char ch) method - The character at the specified index is set to ch.
Example: Example to set character at index 0 with character 'J' using setCharAt() method.
public class SetCharExample {
public static void main(String[] args) {
StringBuffer buffer = new StringBuffer("javaguides");
buffer.setCharAt(0, 'J');
System.out.println(buffer.toString());
}
}
Output;
Javaguides
Comments
Post a Comment