This code does not run correctly. I can't find out why the second time it runs the loop, it does not take a input for firstName variable it just prints "Enter First Name :".
import java.util.Scanner;
public class Test {
public static void main(String[]args){
String[] firstName = new String[30] ;
String[] secondName = new String [30];
int[] marksCourseWorkOne = new int[30];
int i;
Scanner sc = new Scanner(System.in);
for (i = 28; i < firstName.length; i++){
System.out.print("\nEnter First Name : ");
firstName[i] = sc.nextLine();
System.out.print("\nEnter Second Name : ");
secondName[i] = sc.nextLine();
System.out.print("\nEnter Marks For Course Work One : ");
marksCourseWorkOne[i] = sc.nextInt();
}
}
}