Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

create n number of variables of different name at runtime  RSS feed

 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers I want to create n number of objects ( say String ) of different names then How to do this?

if suppose I use for loop



if suppose n value is 10 here above code creates n String objects. But I want all these String objects name unique. How to do that?

Thanks in advance>
 
Mohamed Sanaulla
Bartender
Posts: 3169
34
Google App Engine Java Ruby
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using an array? or a Map? So each entry would be your 1 variable. With Map you can give those entries some name as well
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mohamed. I got it. Thanks once again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!