Menu
Question Index
...

What will be the output of the following program?

public class Cricket {
    public static void main(String[] args) {
        StringBuffer name = new StringBuffer("Sachin tendulkar");
        String copy = name.toString();
        System.out.println(name + "\n" + copy);
    }
}


Sachin tendulkar
(EMPTY)
Sachin tendulkar
Sachin tendulkar
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java StringBuffer

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App