When I run the following code inside a do-while loop (omitted); it prints both lines asking for the name of a song & the size at the same time. However, it never collects a String input for the name before asking for the file size.
I need it to collect a String for the name before asking for the file size (which is not occurring).
How is this happening?
//Interface.java
import java.util.*;
...
Scanner console = new Scanner(System.in); //After importing Scanner.
...
option = console.nextInt(); // User chooses an option (add / delete song, etc.) by pressing a number. Only adding is relevant here.
do { // Code inside a do-while loop which repeats for entering name / file size on 4 songs.
song = console.nextInt(); // User chooses to add name / file size to either song1, song2, song3 or song 4 (there is a maximum of 4 song objects).
System.out.println("Please enter the name of a song.");
name = console.nextLine();
System.out.println("Please enter file size in MB.");
do { // This do-while checks input to be an integer / not negative & then it assigns the input as...
fileSize = console.nextInt();
// end of do-while loop which checks the integer.
// end of do-while loop which lets user add name / size to a maximum of 4 songs.