单项选择题
A. Arrays.sort(s);
B. s = new TreeSet(s);
C. Collections.sort(s);
D. s = new SortedSet(s);
单项选择题 Given: ArrayList a = new ArrayList(); containing the values {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”} Which code will return 2?()
单项选择题 import java.util.*; public class LetterASort { public static void main(String[] args) { ArrayList strings = new ArrayList(); strings.add(aAaA”); strings.add(”AaA”); strings.add(aAa”); strings.add(”AAaa”); Collections.sort(strings); for (String s: strings) { System.out.print(s + “ “); } } } What is the result?()
单项选择题 public static void search(List list) { list.clear(); list.add(”b”); list.add(”a”); list.add(”c”); System.out.println(Collections.binarySearch(list, “a”)); } What is the result of calling search with a valid List implementation?()