试题详情
- 单项选择题 public class Drink implements Comparable { public String name; public int compareTo(Object o) { return 0; } } and: Drink one = new Drink(); Drink two = new Drink(); one.name= “Coffee”; two.name= “Tea”; TreeSet set = new TreeSet(); set.add(one); set.add(two); A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
A、 Tea
B、 Coffee
C、 Coffee Tea
D、 Compilation fails.
E、 The code runs with no output.
F、 An exception is thrown at runtime.
- B
关注下方微信公众号,在线模考后查看
热门试题
- Which element&
- int index&ensp
- 1. public&ensp
- JFrame的缺省布局管理器是()
- 静态成员是根据变量引用的对象的实际类型进
- javax.swing.JPopMenu
- The 8859-1Q
- Which two̳
- 1. public&ensp
- Which method
- What is th
- Which two
- 写一个函数,求一个字符串的长度,在mai
- 如果想把一个对象写入一个流,那么这个类就
- Which statement
- Java有哪些算术运算符、关系运算符、逻
- 如何创建一个表格包型布局管理器的约束对象
- 求[351,432]之间既不能被3整除,
- A class g
- public class&e