声明对象的变量名
Customer customer;
Account account;
可能通过其他类的方法实例化。
public class Bank{
public void addCustomer(String f,String l) {
Customer cust = new Customer(f,l);
customers[numerOfCustomres] = cust;
numerOfCustomres++;
}
}
public Customer getCustomer(int index) {
return customers[index];
}
用方法返回数组中的一个对象 赋地址值给customer,再用customer调用Customer的方法。这样就不用每个Customer都需要赋一个变量名来
。