java泛型与异常

2025-03-03 18:50:45
推荐回答(2个)
回答1:

catch里面加上throw new RuntimeException(e);需要在方法上再抛出异常throws RuntimeException

回答2:

public class Test {
public void do1(List strs){
System.out.println(strs);
}
public static void main(String[] args) {
new Test1().do1((List) ((List) (A.method())));
}
}
class A{
public static List method(){
return null;
}
}