Menu
Question Index
...

What will be the output of the following program?

public class ThomasAlvaEdison {
    public static void main(String[] args) {
        StringBuffer data;
        String inventor = "Thomas Alva Edison";
        String invented = "Bulb";
        data = new StringBuffer(10);
        System.out.println(inventor + " invented " + data + ".");
        data = new StringBuffer(invented);
        System.out.println(inventor + " invented " + data + ".");
    }
}


Thomas Alva Edison invented 10.
Thomas Alva Edison invented Bulb.
Thomas Alva Edison invented .
Thomas Alva Edison invented Bulb.
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