package com.frank.app;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.util.LinkedList;
import java.util.List;
public class App {
private static <T> List<T> demo1(Class<T> clazz) {
T obj = null;
try {
obj = clazz.newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<T> result = new LinkedList<T>();
result.add(obj);
return result;
}
public static void main(String[] args) {
List<String> list = demo1(String.class);
System.out.println(list);
}
---------------------
作者:刘少明
来源:CSDN
原文:https://blog.csdn.net/lsm135/article/details/54141309
版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/moxiaotao/p/10222284.html