棧溢出
public void close(){
try{
con.close();---------這2句反下 rs先close
rs.close();---------- con后close
}catch(SQLException sql){
sql.printStackTrace();
}
}
public void close(){
try{
con.close();---------這2句反下 rs先close
rs.close();---------- con后close
}catch(SQLException sql){
sql.printStackTrace();
}
}
Connection getConnection(){
if(con==null)
...
}
public Conn() 方法改成
public Conn() {
info = new Student();
// con = getConnection(con);
...
} public Student(){
con = new Conn(); 方法改成
public Student(){
con = getConnection();
试一下看问题能解决不?
info = new Student();
con = getConnection(con);
}
public Student(){
con = new Conn();//大家发现问题没?循环的,无止境的构造。 当然内存溢出了!
紫竹牛