我这个为什么每次在第三行打印的都是数组中最后一个元素(list[最后一个])的内容呢?,我试图把Object[]放到外面好像也不行啊
1、 for(int i=1;i<=15;i++){
2、        Object[] o = (Object[]) list[i].get(1);
3、        System.out.println(list[i]);
       o[1].toString();
       o[3].toString();
       Element item = new Element("item");
       Element itemtitle = new Element("title");
       itemtitle.setText(o[2].toString()+"  "+o[6].toString());
       Element itemlink = new Element("link");
       itemlink.setText(this.rssInfoLink+"/main/model/newinfo/newinfo.do?infoId="+o[4].toString());
       Element itemdesc = new Element("description");
       itemdesc.setText(o[5].toString());
       Element itempubDate = new Element("pubDate");
       itempubDate.setText(o[3].toString()+" GMT");
//        Element itemname = new Element("name");
//        itemname.setText(o[6].toString());
       e.addContent(item);
       item.addContent(itemtitle);
//        item.addContent(itemname);
       item.addContent(itemlink);
       item.addContent(itemdesc);
       item.addContent(itempubDate);
       }

解决方案 »

  1.   

    你直接写死,用list[1]、list[2]、list[3]看看,是不是能将3个值都输出来
      

  2.   

     ArrayList[] arrayLists = new ArrayList[16]; 
        ArrayList <Object[]>[] list = arrayLists; 
                list[1] = lquery.executeQuery(ls_sql1); 
        list[2] = lquery.executeQuery(ls_sql2); 
                                。 
                                。 
                list[15] = lquery.executeQuery(ls_sql15); 
    1、 for(int i=1;i <=15;i++){ 
    2、      Object[] o = (Object[]) list[i].get(1); 
    3、      System.out.println(list[i]); 

          }
    做个补充,这个清晰点
      

  3.   

    lquery是什么啊确定数据没有问题?
      

  4.   

    仔细查一下,如果用list[1]写出来值都不对的话,就仔细查查,list中的值是否是自己要的
      

  5.   

    数据没问题!我在进循环前打印,list[14]、list[15]还不一样
      

  6.   

    为什么一进循环list[14]、list[15]就一样了呢?