When you read in the year month day hour minutes with something like nextInt()
it leaves rest of the line in the parser/buffer (even if it is blank) so when you call nextLine()
you are reading the rest of this first line.
I suggest you to use scan.next()
instead of scan.nextLine()
.