第10題
Given:
1. import java.util.*;
2. public class Quest{
3. public static void main(String[] args){
4. String[] colors =
5. {"blue","red","green","yellow","orange"};
6. Arrays.sort(colors);
7. int s2 = Arrays.binarySearch(colors, "orange");
8. int s3 = Arrays.binarySearch(colors, "violet");
9. System.out.print(s2 + "" + s3);
10. }
11. }
What is the result?
(A) 2-1
(B) 2-4
(C) 2-5
(D) 3-1
(E) 3-4
F. 3-5
G. Compilation fails.
H. An exception is thrown at runtime.
詳解 (共 1 筆)
未解鎖
import java.util.*;p...