【背景】
折腾:
期间,需要去New一个List:
List<NameValuePair> headerDict = new List<NameValuePair>();
结果出错:
即:
Cannot instantiate the type List<NameValuePair> |
【解决过程】
1.和之前的:
【基本解决】java中没法new:Cannot instantiate the type HttpParams
类似,所以就是去找到,list的某个实现类型,即可。
2.参考:
Cannot instantiate the type List<Product>
去试试:
List<NameValuePair> headerDict = new ArrayList<NameValuePair>();
然后就可以了:
【总结】
Java中的代码,还真的不适应。。。
没有C#用的爽。
转载请注明:在路上 » 【已解决】Java代码中new List时出错:Cannot instantiate the type List<NameValuePair>