NotSerializableException:费用

时间:2017-08-10 14:37:38

标签: exception serializable

我无法序列化我的对象。有一个例外。我做错了什么?请帮忙。类Expenses实现了Serializable

import java.io.Serializable;

public class Expenses implements Serializable {
    private transient double amount;
    private transient String currency;
    private transient String product;

    public Expenses(double amount, String currency, String product){
        this.amount = amount;
        this.currency = currency;
        this.product = product;
    }

    public String toString(){
        String result = product+" "+amount+" "+currency;
        return result;
    }

    public String getCurrency() {
        return currency;
    }

    public double getAmount() {
        return amount;
    }

    public String getProduct() {
        return product;
    }

}

0 个答案:

没有答案