在Java中,若Student类没有实现Comparable接口,尝试将其作为TreeMap的键会发生什么? A. 编译错误 B. 运行时异常 C. TreeMap将无法正确排序 D. 无任何影响,TreeMap可以正常使用 答案解析 如果Student类没有实现Comparable接口,尝试将其作为TreeMap的键时,TreeMap将无法确定如何对键进行排序,从而导致运行时异常。 正确答案:B