宿題です。以下を実装する必要があります。
private 日付 dateCreated オブジェクトが作成されたときのストア。
private Date dateCreated;
dateCreated の getter メソッド。
public Date getDateCreated() {
return dateCreated;
}
そして、このメインメソッドを実装する必要があります:
public static void main(String[] args){
Account a=new Account(1122,20000,4.5);
a.withdraw(2500);
a.deposit(3000);
System.out.println(a.getBalance());
System.out.println(a.getMonthlyInterestRate()+"%");
System.out.println(a.getDateCreated()); // or another method what can get
//time when the object created
}
getTime() を使用しようとしましたが、コードでどのように使用できるかわかりません。私はいくつかの解決策を見ましたが、常にこのために別のクラスを作成しました。簡単な解決策が欲しいです。(たぶん dateCreated フィールドを宣言するとき)