Set the given character at the given position of StringBuffer object - Java Quiz Question


Write a program to set the given character at given position of StringBuffer object.

Input (StringBuffer, Integer, Character) Output (String)
'Prabhas', 2, 'o' 'Probhas'
'Mahesh Babu', 0, 'R' 'Rahesh Babu'
'Ram Charan', 4, 'c' 'Ram charan'



class SetCharAtStringBuffer
{
    public static void main(String s[])
    {
        StringBuffer sb = new StringBuffer("Prabhas");
        int position = 2;
        char ch = 'o';
        System.out.println("After setting given character at given position of the StringBuffer object is : " + getResultantString(sb, position, ch));

    }


    public static String getResultantString(StringBuffer input, int position, char ch) {
    }

}