Question: Can someone help me stop my loop when the user types in quit. JAVA public static ArrayList songRequest() { ArrayList songs = new ArrayList ();

Can someone help me stop my loop when the user types in quit. JAVA

public static ArrayList songRequest() {

ArrayList songs = new ArrayList();

Scanner scan = new Scanner(System.in);

System.out.println("Enter songs you would like to request (quit when done): ");

String songChoice = scan.nextLine();

// looping until user enter quit

while (!songChoice.equalsIgnoreCase("quit")) {

// adding to playlist

songs.add(songChoice);

// reading next song name

songChoice = scan.nextLine();

}

return songRequest();

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!