网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
解释Comparable和Comparator的区别。
参考答案
更多 “解释Comparable和Comparator的区别。” 相关考题
考题
I don't think I will ever feel()spreading rumors.A、consistentB、commonC、comfortableD、comparable
考题
Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()A、The class implements java.lang.Comparable.B、The class implements java.util.Comparator.C、The interface used to implement sorting allows this class to define only one sort sequence.D、The interface used to implement sorting allows this class to define many different sort sequences.
考题
多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used to implement sorting allows this class to define only one sort sequence.DThe interface used to implement sorting allows this class to define many different sort sequences.
考题
单选题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);
考题
单选题实现下列哪个接口,可以启用序列化功能()。A
Runnable接口B
Comparable接口C
Serializable接口D
Comparator接口
热门标签
最新试卷