Which definition of the ColorSorter class sorts the blocks list? 12/20/2019 – by Mod_GuideK 4 Given: and the code fragment: Which definition of the ColorSorter class sorts the blocks list? A. B. C. D. SHOW ANSWERSCorrect Answer: C Explanation/Reference: Download Printable PDF. VALID exam to help you PASS.
No, you are wrong. As long as compareTo(T o) may contain only 1 argument, the code fragment in B would not compile. So, correct answer is C. 2 Reply
C
Second parameter to sort method should be Comparator and not Comparable.
C
Tested
B
public interface Comparable
{
public int compareTo(T o);
}
No, you are wrong. As long as compareTo(T o) may contain only 1 argument, the code fragment in B would not compile. So, correct answer is C.