+ 7

Can anyone help?

I want to create such a program that automatically names the variables in such a way that if the user wants 6 variables it would automatically create them and name them in such a way that the first variable is d1 and then the variable names go on till d6

8th Mar 2017, 1:30 PM
Prabhakar Dev
Prabhakar Dev - avatar
7 Antworten
+ 4
err how did I forget about arrays
8th Mar 2017, 2:07 PM
Prabhakar Dev
Prabhakar Dev - avatar
+ 4
But I want to do such a thing for Scanner in java
8th Mar 2017, 2:14 PM
Prabhakar Dev
Prabhakar Dev - avatar
+ 4
one more thing can I name the variable as per user input
8th Mar 2017, 2:24 PM
Prabhakar Dev
Prabhakar Dev - avatar
+ 4
Well if there could be programs that modify their code themselves I think that there could be programs that could modify themselves as per user input
8th Mar 2017, 2:30 PM
Prabhakar Dev
Prabhakar Dev - avatar
+ 2
you can do it without changing the source code just have a for loop that has a iteration variable that is entered by the user and run it through an array to store each value.
8th Mar 2017, 3:49 PM
Jason Hoffman
Jason Hoffman - avatar
+ 1
do it in array...automatically first element is array [0] and it will goes till array [n-1]
8th Mar 2017, 1:57 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar