Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class GuessTheOutput {
    public static void main(String args[]) {
        Set<GuessTheOutput> set = new TreeSet<GuessTheOutput>();
        set.add(new GuessTheOutput());//LINE A
        set.add(new GuessTheOutput());//LINE B
        set.add(new GuessTheOutput());
        System.out.println(set);
    }
}


Some output will print
Compile and runs successfully but output will not produce
Compilation successfully but Runtime Error will occurs
Compilation Error

Doubts

Problems

Topic: Java TreeSet - TreeSet Examples 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