Menu
Question Index
...

What will be the output of the following program?

public class GoodEvening {
    public static void bufferReplace(StringBuffer text) {
        text = text.append("c");
    }
    public static void main(String args[]) {
        String textString = new String("java");
        StringBuffer textBuffer = new StringBuffer("java");
        bufferReplace(textBuffer);
        System.out.println(textString + textBuffer);
    }
}


javajavac
cavajavac
javac
java
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java append() Method 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