外部类是==>银行,它是singletonthe (getTheOneBank())将返回单例对象。
内部类是==>帐户,有许多实例,如: id、moneyAmount、.
如何从另一个类访问ArrayList (accounts)中对象(Account)的(id)实例,比如说(主类)。
这是我的代码:
for (Bank.Account obj : Bank.getAccounts())
{
System.out.println(obj.id);
}发布于 2017-01-06 09:28:22
Bank bank = new Bank();
for (Bank.Account obj : bank.getAccounts())
{
System.out.println(obj.id);
}https://stackoverflow.com/questions/41501563
复制相似问题