Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class Dos {
    public static void main(String[] args) {
        NavigableSet<Integer> check = new TreeSet<Integer>();
        check.add(2);
        check.add(5);
        check.add(9);
        check.headSet(6);
        System.out.println(check);
    }
}


[2, 5, 9]
[6, 2, 5, 9]
[2, 5, 6, 9]
[2, 5, 9, 6]
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