Variables in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Variables in Java

Hello! I have a question , how to create some variables, amount of which set user Example : Int1 = 5 Int2 = 4 ... IntN= M * without making massiv, will be better with using for or while P/s sorry for bad English 😅

22nd Feb 2018, 9:58 AM
Kanat
Kanat - avatar
5 Answers
+ 2
why dont you use an array? check this thread: https://www.sololearn.com/Discuss/1085371/using-arrays
22nd Feb 2018, 10:32 AM
J Domingo Jiménez J
J Domingo Jiménez J - avatar
22nd Feb 2018, 10:20 AM
vishal jamdagni
vishal jamdagni - avatar
+ 1
You want to create as may variables as user inputs? or you want to assaign values that user inputs to variables?
22nd Feb 2018, 10:22 AM
Sad
Sad - avatar
+ 1
do you want to give it as a user input?
22nd Feb 2018, 10:33 AM
Nawodani Jayasooriya
Nawodani Jayasooriya - avatar
0
type_of_variable variable;
22nd Feb 2018, 2:13 PM
idir