Menu
Question Index
...

What will be output of the following program?

public class StringBufferDemo {
    public static void main(String[] args) {
        StringBuffer buff = new StringBuffer("Oh! Java Programming");
        System.out.println("Buffer = " + buff);
        char[] array = new char[]{'M', 'e', 'r', 'i', 't', ' ', 'C', 'a', 'm', 'p', 'u', 's'};
        buff.getChars(2, array.length, array, 3);
        System.out.println(array);
    }
}


Buffer = Oh! Java Programming
Merit Campus
Buffer = Oh! Java Programming
! Java Programming
Buffer = Oh! Java Programming
Mer! Java Pro
Compilation Error or Runtime Error

Doubts

Problems

Topic: StringBuffer getChars() Method In Java 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