How do I make a progression with a variable in Java?

后端 未结 1 1251
逝去的感伤
逝去的感伤 2021-01-28 19:11

I am interested in how to call a variable that changes, such as customer1, customer2, customer3, etc. These customer variables are populat

相关标签:
1条回答
  • 2021-01-28 19:14

    If you have numbered variables, then use a list. Something like

    ArrayList<Customer> customers = new ArrayList<Customer>();
    
    customers.add(new Customer("name"));
    
    customers.get(0).returnName();
    
    0 讨论(0)
提交回复
热议问题