0

how to assign values using arrays at runtime ?

10th Jul 2016, 2:37 PM
aravind annamalai
aravind annamalai - avatar
2 Answers
+ 2
int [] nums = new int [size]; for (int i=0; i <size; i++){ Scanner input = new Scanner(System.in); nums [i] = input.nextInt (); } choose the size of ur array urself or fill it dynamically
11th Jul 2016, 2:34 PM
Sardor
Sardor - avatar
+ 1
for runtime is better to use arraylist except arrays
10th Jul 2016, 4:04 PM
Rao Arsalan
Rao Arsalan - avatar