你这个方法到底返回Collection还是Vector?
解决方案 »
- spring2.0里怎么指定org.springframework.web.context.request.RequestContextListener
- 专家来帮推荐个笔记本。
- 基础问题
- hibernate查询问题,报org.hibernate.hql.ast.QuerySyntaxException异常?
- quartz任务管理器执行多个crud操作时报Illegal attempt...a collection with two open sessions错误
- Access denied for user 'root'@'localhost' (using password: YES)
- Blob 字段的操作!感谢
- 为什么在JB里启动weblogic服务,输入http://localhost:7001/index.jsp可以运行,但是自己在开始菜单->程序里,启动Start Default Server后
- 请教jsp乱码问题
- log4j2 自定义layout 出错 error contains an invalid element or attribute
- 请问j2ee上有没有类似.net上的服务器端控件?
- 请问我用哪种架构比较合适?(在线讨论各种架构性能问题)
要强制转换一下吧!
{
Vector v=new Vector();
。。
return v;
}
{
Vector v=new Vector();
。。
return v;
}
改成public List getTotalUser() throws Exception
{
Vector v=new Vector();
。。
return v;
}
List是vector的父接口,它支持你想用的转换,再说这样更能体现多态!
对吗?
Iterator<----Collection<----Map
___|___
| |
List Set
|
AbstractList
|
Vector
|
Stack
这个只是其中一个很小的部分,但是足以理解上面的问题.
你要掉用那个方法首先要生成这个方法所在的class的实例,然后在调用该方法.
调用的时候有你可以强制类型转换就可以了.
Vector实现了List接口的一个具体的类(Concreate class)在更广的意义上讲它是一种
Collection(一个更上层的接口--List的父接口)