add objects with different name through for loop

前端 未结 6 981
北海茫月
北海茫月 2020-12-10 16:18

What is the best way to do the following:

List list = new LinkedList();

for(int i=0; i<30;i++)
{
  MyObject o1 = new MyOb         


        
6条回答
  •  [愿得一人]
    2020-12-10 16:50

    Create the object give it a name, add your constructors. then add the object name to the arraylist.

提交回复
热议问题