cool hit counter
Cafe4Java
Cafe4Java
 

SCJP Mock Exam Answers
A2)
Answer : C, D, F
Explanation :
Option A is incorrect option because it will sort the array 'bookArray' in the ascending alphabetical order of their author.
Option B is incorrect option because it will generate the following Compilation error:
>>>>>>>
type BookComparator does not take parameters
Comparator<Book> comparator = new BookComparator<Book>();
>>>>>>>
The correct line of code is:
Comparator comparator = new BookComparator();
Option C and D are correct options. A Comparator can be defined either as an anonymous inner class or as a named inner class, within a static method.
Option E is incorrect option because the 'Arrays' class does not define method 'sortArray'.
Option F is correct option.
Option G is incorrect option because the 'Arrays' class does not define method 'sortCollection'.


<<<< Return to Q2 <<<<<         >>>> Go to Q3 >>>>

Submit your feedback on this mock exam


 
 
Custom Search
     
Cafe4Java