Replace the StringBuffer with in given range - Java Quiz Question


Write a program to replace the given StringBuffer with given string in between the given range.

Input (StringBuffer, int, int, String) Output (String)
'HelloWorld', 0, 5, 'Mobeen' 'MobeenWorld'
'JavaSchool', 0, 4, 'Online' 'OnlineSchool'
'KitKat', 3, 6, 'Cat' 'KitCat'
'GoodBye', 4, 7, 'Night' 'GoodNight'



class ModifyingStringBuffer
{
    public static void main(String s[])
    {
        StringBuffer stringBuffer = new StringBuffer("HelloWorld");
        System.out.println("The resultant string is : " + getModifyiedString(stringBuffer, 0, 5, "Mobeen"));

    }


    public static String getModifyiedString(StringBuffer stringBuffer, int startIndex, int endIndex, String replaceString) {
    }

}