我必须在主要方法中创建一个列表对象,但我不知道该怎么做。我想创建一个对象的类的构造函数有一个列表作为参数。
如何创建 CashMachine 类的对象?
顺便说一句,我不会写所有的类,因为它很长。
这是我的课程:
public class CashMachine {
private State state;
List<Account> accountList;
private CashCard cashCard;
private Account selectedAccount;
public CashMachine(List<Account> accountList){
this.accountList = accountList;
}
}
public class TestMain {
public static void main(String[] args) throws Exception {
CashMachine cashMachineObj = new CashMachine(); //it is false
}
}