如何用java 设计一个货物类?

问题遇到的现象和发生背景

设计一货物类,字段1:名称(String);字段2:入货时间(Date).编写代码,使得一货物数组中的多个货物对象根据用户选项既可由名称排序也可由入货时间排序。在测试程序中测试货物类实现的功能(可由用户输入三种货物的信息进行测试)。

问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
public class Goods {
    String name;   //货物名称
    Date entryTime;   //入货时间

    //Getter和Setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

   public Date getEntryTime() {
        return entryTime;
    }

    public void setEntryTime(Date entryTime) {
        this.entryTime = entryTime;
    }
}