Collections and Generics

© examsiri.com
Question : 25 of 53
 
Marks: +1, -0
Given:
1. public class Drink implements Comparable {
2.   public String name;
3.   public int compareTo(Object o) {
4.    return 0;
5.   }
6. }
and:
7. Drink one = new Drink();
8. Drink two = new Drink();
9. one.name= "Coffee";
10. two.name= "Tea";
11. TreeSet set = new TreeSet();
12. set.add(one);
13. set.add(two);

A programmer iterates over the TreeSet and prints the name of each Drink object.
What is the result?
Go to Question: