比如你定义如下: List<String> result= new ArrayList(); 有警告但是可以正常工作,修改成下面这样就行了 List<String> result= new ArrayList<>();