在Java中,若TreeMap的键为Student对象,且Student类实现了Comparable接口,以下哪个选项正确描述了TreeMap的排序方式?
答案解析
TreeMap在Java中是基于红黑树实现的,它要求键必须实现Comparable接口或者提供Comparator。因此,当TreeMap的键为Student对象且Student类实现了Comparable接口时,TreeMap会根据Student对象的自然顺序进行排序。选项A正确描述了TreeMap的排序方式。
正确答案:A