This is the code :
Scanner s = new Scanner(System.in);
System.out.print("Enter the number of lines : ");
int a = s.nextInt();
String[] array = new String[a];
for (int i = 0 ; i < array.length; i++) {
System.out.print("Enter line " + i + " : ");
array[i] = s.nextLine();
System.out.println();
}
After first Run ( If a is set to 4 ) :
Enter the number of lines : 4
Enter line 0 :
Enter line 1 : test1
Enter line 2 : test2
Enter line 3 : test3
it skiped Line 0 by itself.. why ?