20161107问题解析请点击今日问题下方的“【Java每日一题】20161108”查看(问题解析在公众号首发,公众号ID:weknow619)
List<String> list = new List<String>;
System.out.println(list instanceof List<String>);
package Nov2016;
import java.util.TreeSet;
public class Ques1108 {
public static void main(String[] args){
Animal dog = new Animal("dog");
Animal cat = new Animal("cat");
TreeSet<Animal> animals = new TreeSet<Animal>();
animals.add(dog);
animals.add(cat);
System.out.println(animals); // 1
}
}
// 动物类
class Animal implements Comparable<Animal>{
private String name;
Animal(String name){
this.name = name;
}
@Override
public int compareTo(Animal o){
return 0;
}
@Override
public String toString(){
return name;
}
}
今日问题:请问1处输出结果是什么?(点击以下“【Java每日一题】20161108”查看20161107问题解析)