Menu
Question Index
...

What will be the output of the following program?

public class Orange {
    public static void main(String args[]) {
        StringBuffer buf = new StringBuffer("Append float: ");
        float c = 1.25f;
        buf.append(c);
        buf.append("\n");
        buf.append("Append object: ");
        Object obj = new String("orange");
        buf.append(obj);
        System.out.println(buf.toString());
    }
}


Append float: 1.25\nAppend object: orange
Append float: 1.25
Append object: orange
Append float: 1.25
Append object:
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