java - Create Object Name with Array -


i want create object name using arrays. how can it?

for example :

string dizi ={"person1","person2","person3"}; person dizi[0] = new person(); 

you cannot change type of object stored in array string person. instead, need 2 separate arrays, , supposing have person(string) constructor, loop on first array fill second array:

string[] names = {"person1","person2","person3"}; person[] persons = new person[3]; (int = 0; < 3; i++)     persons[i] = new person(names[i]); 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -