Menu
Question Index
...

What will be the output of the following program?

public class Friends {
    public static void main(String[] args) {
        String name = "Raju";
        StringBuffer sb = new StringBuffer(name);
        System.out.println(sb);
        sb.replace(2, 4, "vi");
        System.out.print(sb);
    }
}


Raju
Raju
Raju
Ravi
Compilation Error
Runtime Error

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