Menu
Question Index
...

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) {
    }

}

Doubts

Problems

Topic: Java StringBuffer replace() Method With Example

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App