Menu
Question Index
...

What values will treeSet contain at the end of the program?

import java.util.*;

public class TreeSet
{
    public static void main(String rgs[])
    {
        List<String> list = new ArrayList<String>();
        list.add("J");
        list.add("A");
        list.add("V");
        list.add("A");
        list.add(" ");
        list.add("P");
        list.add("R");
        list.add("O");
        list.add("G");
        list.add("R");
        list.add("A");
        list.add("M");
        list.add("M");
        list.add("I");
        list.add("N");
        list.add("G");
        
        java.util.TreeSet<String> treeSet = new java.util.TreeSet<String>(list);
    }
}


J, A, V, A,  , P, R, O, G, R, A, M, M, I, N, G
J, V, A,  , P, R, O, G, M, I, N
J, V,  , P, O, I, N
J, V, A, P, R, O, G, M, I, N
Compilation Error or Runtime 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