完成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();//报错时缺少此行
    }
        
原文地址:https://www.cnblogs.com/masker99/p/11727291.html