Loading

完成Account编程练习遇到的问题

 

 Exception in thread "main" java.lang.NullPointerException java:指的是空指针异常

原因是:一个对象并不存在时又调用了它的方法,即产生异常。

    public Account(){
    this.id = 0;
    this.balance = 0;
    this.annualInteresRate = 0;
    this.dateCreated = new Date();//报错时缺少此行
    }
    
    public Account(int test_id,double test_balance){
        this.id = test_id;
        this.balance = test_balance;
        this.dateCreated = new Date();//报错时缺少此行
    }
        

 

posted @ 2019-10-23 16:56  搭积木的娃  阅读(146)  评论(0编辑  收藏  举报