单项选择题

11. public class Counter { 
12. public static void main(String[] args) { 
13. int numArgs = /* insert code here */; 
14. } 
15. } 
and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?() 

A. args.count
B. args.length
C. args.count()
D. args.length()
E. args.getLength()


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

1. interface DoStuff2 { 
2. float getRange(int low, int high); } 
3. 
4. interface DoMore { 
5. float getAvg(int a, int b, int c); } 
6. 
7. abstract class DoAbstract implements DoStuff2, DoMore { } 
8. 
9. class DoStuff implements DoStuff2 { 
10. public float getRange(int x, int y) { return 3.14f; } } 
11. 
12. interface DoAll extends DoMore { 
13. float getAvg(int a, int b, int c, int d); } 
What is the result?() 

A. The file will compile without error.
B. Compilation fails. Only line 7 contains an error.
C. Compilation fails. Only line 12 contains an error.
D. Compilation fails. Only line 13 contains an error.
E. Compilation fails. Only lines 7 and 12 contain errors.
F. Compilation fails. Only lines 7 and 13 contain errors.
G. Compilation fails. Lines 7, 12, and 13 contain errors.

9.单项选择题

Given: 
ArrayList a = new ArrayList(); 
containing the values {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”} Which code will return 2?() 

A. Collections. sort(a, a.reverse()); int result = Collections.binarySearch(a, “6”);
B. Comparator c = Collections.reverseOrder(); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”);
C. Comparator c = Collections.reverseOrder(); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”,c);
D. Comparator c = Collections.reverseOrder(a); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”,c);
E. Comparator c = new InverseComparator(new Comparator()); Collections.sort(a); int result = Collections.binarySearch(a, “6”,c);