在Java中,若Student类没有实现Comparable接口,尝试将其作为TreeMap的键会发生什么?

答案解析

如果Student类没有实现Comparable接口,尝试将其作为TreeMap的键时,TreeMap将无法确定如何对键进行排序,从而导致运行时异常。
正确答案:B
随机推荐
开始刷题