你在初始化中加入试试:class test2()
{
  ResultSet resultSet = null;
   public test2(ResultSet result){
       resultSet = resylt;
   }
}test1中改称:
test2 test =new test2(resultSet);
    test.thinExpertToXML();

解决方案 »

  1.   

    将test2类中的public static void main(String [] args)方法去掉.
      

  2.   

    你怎么调用的test2的thinExpertToXML(ResultSet resultSet)方法的呀?
    你应该是
    在test1内main()方法内:
    test2 t = new test2();
    t.thrinExperToXML(resultSet);-------应该是这样调用的
      

  3.   

    public class test2 {  public static void main(String[] args) {
      }
      public  String thinExpertToXML(ResultSet resultSet)
      {
         try{
             resultSet.next();
             System.out.println(resultSet.getString("id"));
         }catch(SQLException e){
            e.printStackTrace();
         }
     return null;
      }}
    这样可以调试成功,但是,已经是下一条记录了,我平时用的是vector,或者是写一个对应于字段的类,然后用对象数组