I need to create an array from console.
I do:
int forbiddenSequenceCount = scanner.nextInt();//1
String[] forbidden = new String[forbiddenSequenceCount];//2
for (int k = 0; k < forbiddenSequenceCount; k++) {//3
forbidden[k] = scanner.nextLine(); //4
}
But when I input forbiddenSequenceCount = 1
line 4 was not waiting while I input String.
It's just executed.
What i'm doing wrong?
Input :
2
3 0 1 0
I need put 3 0 1 0
to array.