I'm trying to scan a text file and store the strings into an array while ignoring the first line. When I run the code it has a blank spot and the array is missing a string. Is there anyway to scan the file and have it skip over the int value and include all the strings?
File file = new File("input.txt");
Scanner scan = new Scanner(file);
int size = scan.nextInt();
String[] blocks = new String[size];
for (int i = 0; i < blocks.length; i++) {
blocks[i] = scan.nextLine();
}
System.out.println(Arrays.toString(blocks));
[, MXTUAS, OQATGE, REWMNA, MBDFAC]