Scanner class is skipping lines

Posted by user2403304 on Stack Overflow See other posts from Stack Overflow or by user2403304
Published on 2013-06-27T22:17:29Z Indexed on 2013/06/27 22:21 UTC
Read the original article Hit count: 123

Filed under:

I'm new to programing and I'm having a problem with my scanner class. This code is in a loop and when the loop comes around the second, third whatever time I have it set to it skips the first title input. I need help please why is it skipping my title scanner input in the beginning?

System.out.println("Title:");

list[i].title=keyboard.nextLine();

System.out.println("Author:");

list[i].author=keyboard.nextLine();

System.out.println("Album:");

list[i].album=keyboard.nextLine();

System.out.println("Filename:");

list[i].filename=keyboard.nextLine();

© Stack Overflow or respective owner

Related posts about java