// Program to explain the following StringBuffer function :
// void setCharAt( int where, char ch )class MsetCharAt1
{
public static void main( String args[ ] )
{
StringBuffer sb1 = new StringBuffer( "Java Nrogramming Examples." );
System.out.println( " String Before Replacing = " + sb1 );
sb1.setCharAt( 5, 'P' );System.out.println( " String After Replacing = " + sb1 );
}
}
Output:String Before Replacing = Java Nrogramming Examples.
String After Replacing = Java Programming Examples.