List list = new ArrayList(0); Method method = list.class.getMethod("get",null); Class returnTypeClass = method.getReturnType(); returnTypeClass就是返回类型了
通过反射取到List<T>中T的类型
最新推荐文章于 2024-08-23 07:50:17 发布
List list = new ArrayList(0); Method method = list.class.getMethod("get",null); Class returnTypeClass = method.getReturnType(); returnTypeClass就是返回类型了