Menu
Question Index
...

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

}

Doubts

Problems

Topic: Java charAt() And setCharAt() Methods in StringBuffer

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App