看看这个是什么问题

star_123soul 2006-08-08 01:22:30
这个异常怎么回事啊
woaikkndException in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
at java.util.Vector.get(Unknown Source)
at my_blog.text.main(text.java:27)
...全文
141 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yyfhz 2006-08-08
  • 打赏
  • 举报
回复
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
=============================================
从错误信息来看,应该是你用下标1去访问某个Array 或者是 vector,但是这个Array 或者 Vector中根本就没有元素。 估计问题出在访问代码上。
star_123soul 2006-08-08
  • 打赏
  • 举报
回复
写了个测试的类
star_123soul 2006-08-08
  • 打赏
  • 举报
回复
eclipse
huihui0103 2006-08-08
  • 打赏
  • 举报
回复
不全呀。。。在哪里调用的?
star_123soul 2006-08-08
  • 打赏
  • 举报
回复
这个是代码
star_123soul 2006-08-08
  • 打赏
  • 举报
回复
public Vector selectOutput3(String title,String name){
this.title = title;
this.name = name;
try {
rst = stat.executeQuery("select * from Commentary where title='"+title+"'and username='"+name+"'");
System.out.println("select * from my_blog where username='"+name+"'");
Vector v = new Vector();
while(rst.next()){
Commentary = rst.getString("Commentary");
System.out.println(Commentary);
v.addElement(Commentary);
}
return v;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
huihui0103 2006-08-08
  • 打赏
  • 举报
回复
超出了数组的大小。。你的vector的长度被超出了,把代码帖出来看看

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧