单项选择题

interface DeclareStuff{ 
public static final int EASY = 3; 
void doStuff(int t); } 
public class TestDeclare implements DeclareStuff { 
public static void main(String [] args) { 
int x=5; 
new TestDeclare().doStuff(++x); 
} 
void doStuff(int s) { 
s += EASY + ++s; 
System.out.println(”s “ + s); 
} 
} 
What is the result?() 

A. s 14
B. s 16
C. s 10
D. Compilation fails.
E. An exception is thrown at runtime.


您可能感兴趣的试卷

你可能感兴趣的试题

7.单项选择题

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);

10.单项选择题

Given: 
int[] myArray=newint[] {1, 2,3,4, 5}; 
What allows you to create a list from this array?() 

A. List myList = myArray.asList();
B. List myList = Arrays.asList(myArray);
C. List myList = new ArrayList(myArray);
D. List myList = Collections.fromArray(myArray);