Home Tutorial Java Scjp Part9 SCJP Module-9 Question-28


Share on Google+Share on Google+
SCJP Module-9 Question-28
Posted on: July 19, 2010 at 12:00 AM
The Sample program given below will test your understanding about the NavigableSet set in the Collection framework of Java.

Given below the sample code :

1  import java.util.ArrayList;
2  import java.util.List;
3  import java.util.NavigableSet;
4  import java.util.TreeSet;
5  public class Check {
6  public static void main(String... args) {
7  List<Integer> l = new ArrayList<Integer>();
8  lst.add(12);
9  lst.add(6);
10 lst.add(2);
11 lst.add(3);
12 lst.add(30);
13 lst.add(21);
14 NavigableSet<Integer> nset = newTreeSet(l);
15  // Place code here
16  }

What code line should be at line 15 to print all the element less than 12 in the given array list ?

1. System.out.println( nset.higher(12));

2. System.out.println( nset.lower(12));


4.No need to add any line.




Related Tags for SCJP Module-9 Question-28:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 19, 2010

Recommend the tutorial

Advertisements Advertisements