搜索字符串这段没有问题,我主要是不理解
tt[0].x = rs.getString(1);
为什么老是出错

解决方案 »

  1.   

    当然了 你只是new了一个数组对象tt 但是对于数组里的每个类型为a的对象tt[0]到tt[9]  都没有初始化 在使用它们之前你应该首先初始化 例如tt[0]=new a();
      

  2.   

    class b{
       a tt[] = new a[10]();
    //加上这句
      for( int i =0;i<10;i++)
            tt[i]=new a();   ............另外你的class a改成如下更好
    class a{
       string x = null;
    }