by Dinesh Thakur

char charAt (int index) : This method returns the character in the string buffer at the specified index position. The index of the first character is 0, the second character is 1 and that of the last character is one less than the string buffer length. The index argument specified must be greater than or equal to 0 and less than the length of the string buffer. For example, strl.charAt(1) will return character e i.e. character at the index position 1 on the StringBuffer str1.

public class StringBuffercharAt

{
        public static void main(String[] args)
     {
            StringBuffer sl = new StringBuffer("Hello Java");
            System.out.println("sl.charAt(1) : " + sl.charAt(1));
      }
}

StringBuffer charAt() Java Example