How to accept values into an array dinamically | Selenium Forum
M
Posted on 16/09/2016
I Tried to assign values into an array dynamically.It couldn't happen. Please help me on this

M
Replied on 16/09/2016

how are you trying?


M
Replied on 17/09/2016

i don't know how to assign them dinamically. Even i don't want to initialize variable during declaration. I want to initialize them during in between the program . How to do it.

for ex:-

public class{
int a;

Public static void main(String [] args){

a=10; // i don't want to do like this . It should ask user input to enter values.So that user can enter what ever value they want.

}

}


M
Replied on 17/09/2016

http://stackoverflow.com/questions/5287538/how-can-i-get-the-user-input-in-java

[code:20u5j5e1]Scanner reader = new Scanner(System.in); // Reading from System.in
System.out.println("Enter a number: ");
int n = reader.nextInt(); // Scans the next token of the input as an int.
[/code:20u5j5e1]