为啥会出现空指针的,有点不理解,
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Test {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Jdbc jdbc=new Jdbc();
String sql_1="select * from user where name=?";
PreparedStatement preSta = jdbc.createPreSta(sql_1);
preSta.setString(1,"小明");
ResultSet resultSet = preSta.getResultSet();
while (resultSet.next()){
System.out.println(resultSet.getString("name"));
}
}
}
他这里的第12行就是while那行