1. import java.util.*;
2.
3. public class LetterASort{
4. public static void main(String[] args){
5. ArrayList
6. strings.add("aAaA");
7. strings.add("AaA");
8. strings.add("aAa");
9. strings.add("AAaa");
10. Collections.sort(strings);
11. for(String s : strings){System.out.print(s + " ");}
12. }
13. }
What is the result?
A. Compilation fails.
B. aAaA aAa AAaa AaA
C. AAaa AaA aAa aAaA
D. AaA AAaa aAaA aAa
E. aAa AaA aAaA AAaa
F. An exception is thrown at runtime.
答案:C
參考:12-2-2 Collections類別、12-4-5 List集合
沒有留言:
張貼留言