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]
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.