Menu
Question Index
...

What will be the output of the following program?

public class InsertMethod {
    public static void main(String args[]) {
        StringBuffer s = new StringBuffer("output of the following program?");
        s.insert(10, 'f');
        System.out.println("After insert char: " + s);
        Object obj = new String("two");
        s.insert(11, obj);
        System.out.println("After insert obj: " + s);
    }
}


After insert char: output of fthe following program?
After insert obj: output of twothe following program?
After insert char: output of fthe following program?
After insert obj: output of ftwothe following program?
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Object As A Super Class In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App