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

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-19
Posted on: July 17, 2010 at 12:00 AM
Advertisement
The sample program given below will test your understanding about the List and Collection interface of Collection framework.

Given below the sample code :

import java.util.*;
public class z {
public static void Find(List<String> list) {
list.clear();
list.add("ba");
list.add("aa");
list.add("ca");
list.add("ca");
System.out.println(Collections.binarySearch(list, "ca"));
System.out.println(list);
}
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
Find(list);
}}


What will be the output of the above code ?

1. Undefined : no output

2. 2

3. [ ba, aa , ca, ca ]

4. 2  [ba, aa , ca, ca]

Answer

(4)


Advertisement

Related Tags for SCJP Module-9 Question-19:


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 17, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com