62,634
社区成员




public static <T> T fun1(T t){
return t;
}
public static <T> T fun2(String str){
return (T)new Object();
//这里有警告 Type safety: Unchecked cast from Object to T
}
int s = fun2("ssssssssssss");//传入参数String,返回类型int
System.out.println(s);