Java 在使用Conllections中的bianarySeach ()方法时报错 no instance(s) of type vaiable(s) T text so that Student conforms to Comparable 异常处理

异常类型:checked 异常,无法通过编译,具体情况如下所示

异常原因:如IDEA所提示,变量list没有合适的类型

处理方式:去掉ArrayList后面的泛型

 |--处理后

猜你喜欢

转载自www.cnblogs.com/twuxian/p/11252796.html