Help with Expected errors!

This is my code!
import java.util.Scanner; //needed to use Scanner for input
public class Pandora {
public static void main(String[] args) {

//Declare variables
String lastName = "";
int Selection=0;

//Create a Scanner object
Scanner input = new Scanner(;

//Display the Opening Statement which includes the Pandora Menu
System.out.println("******WELCOME TO PANDORA!*******" );
System.out.println(" Pandora Menu:" );
System.out.println(" 1- Create New Pandora Channel" );
System.out.println(" 2- Play Pandora Channel" );
System.out.println(" 3 -Exit Pandora" );

//Prompt the user for their last name and menu choice option
System.out.print("Please Input last Name and Menu Choice");

//Read the user's lastname and read the user's menu choice; Parse string if necessary!
lastName = input.nextLine();
Selection = input.nextInt();

//Convert last name to uppercase
lastName = lastName.toUpperCase();
//Control statement (if()/else if() or switch()) that is based on the user's menu choice
//process the user's menu choice (options: 1, 2, 3, other)
if (Selection == 1){
System.out.println(" You have selected the CREATE NEW PANDORA CHANNEL menu item!");
System.out.println(" Please enter the name of the New Channel:");
System.out.println(lastName = lastName.toUpperCase()+ " You have successfully created the following Pandora Channel:");
selection = input.nextInt();
else if (Selection == 2){
switch (selection) {
System.out.println("You have selected the PLAY PANDORA CHANNEL menu item!");
System.out.println("The user:currently has the following channels");
System.out.println(" 1- Justin Bieber");
System.out.println(" 2- Heartland");
System.out.println(" 3- Carrie Underwood");
System.out.println(" 4- The Band Perry");
System.out.println(" 5- Kelly Clarkson");
System.out.println(" 6- Florida Georgia Line");
System.out.println(" 7- Blake Shelton");
System.out.println(" 8- Rihanna");
System.out.println(" 9- Daughtry");
System.out.println(" 10- Ashley Tisdale");

//Prompt the user for their selection
System.out.print("\n Which channel would you like to listen to? (Enter 1, 2, 3, 4, 5, 6, 7, 8, 9 , or 10): ");
int selection = input.nextInt();
//Validate user selection
if (((selection == 1){
System.out.println(Justin Bieber);
if (((selection == 2){
if (((selection == 3){
System.out.println(Carrie Underwood);
if (((selection == 4){
System.out.println(The Band Perry);
if (((selection == 5){
System.out.println(Kelly Clarkson);
if (((selection == 6){
System.out.println(Florida Georgia Line);
if (((selection == 7){
System.out.println(Blake Shelton);
if (((selection == 8){
if (((selection == 9){
if (((selection == 10){
System.out.println(Ashley Tisdale);
if (((selection => 11){
}// end of switch

else if (Selection == 3) {
System.out.println("You have selected the EXIT PANDORA menu item");
System.out.println(Selection + "is not a valid selection. Please try again.");
System.out.println(lastName = lastName.toUpperCase() +" Thank you being a valued listener!" );
//Display Thank you message
System.out.println("*******GOODBYE PANDORA LISTENER*******");
}//end of main
}//end of class

And this is the errors I get error: case, default, or '}' expected
System.out.println("You have selected the PLAY PANDORA CHANNEL menu item!");
A million of these for every Sytem.out.println


  • First of, syntax highlighting is a thing, use it the next time you post code.

    Now to the problem at hand. Do you even know how switch statement works? You get that error because the way you wrote it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion