关于DatabaseHelper extends SQLiteOpenHelper的操作,
@Override
public void close() {   
  if (this != null) {   
  this.close();   
 } }程序运行时正常,退出程序时this.close(); 这句话报错java.lang.StackOverflowError
本人菜鸟,谢谢了。

解决方案 »

  1.   

    嵌套,永无止境,当然StackOverflow了this != null永远为真!
      

  2.   

    public void close() {   //1
      if (this != null) {   //2
      this.close();         //3
     } }2一直为真,进入3,3调用close方法,回到1,继续判断2,一直递归循环,导致堆栈溢出。
      

  3.   

    明白了  if (this != null) { //2
             this.close(); //3
    3还是嵌套  所以栈溢出。。囧死了。谢谢
      

  4.   

    无语路过永远为真的判断给去掉,跟没去还是一样的:this.close()是要干什么呢,有什么实际意义?是要关别的吧,可不是this!好好学学语言才是根本!