Is there a way to create a certain number of double variables based on user input. For example a user has three cars so when asked by the software how many vehicles he has and he enters the number 3 my software will create 3 double variables named car01, car02, car03 for example. I've been googling this and can't seem to find a way to do it without just adding a bunch of variables that will not be used. Thanks if anyone can help.

No, you can't create variables like car01 at runtime. You can use a Map(like HashMap) and save data in it using a key = "car01" with any value you want.

No, you can't create variables like car01 at runtime. You can use a Map(like HashMap) and save data in it using a key = "car01" with any value you want.

Aww man that would have saved a lot of work lol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.