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

后端 未结 1 1227
逝去的感伤
逝去的感伤 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 customers = new ArrayList();
    
    customers.add(new Customer("name"));
    
    customers.get(0).returnName();
    

    0 讨论(0)
提交回复
热议问题