Orphaned default?


#1

Hey there!
I'm new to codecademy and having some problems with the Continents exercise----I keep getting an orphaned default message and can't figure out why...thanks if you can call out what might be causing this?

Continents.java:28: error: orphaned default
default: System.out.println ("Undefined continent!");
^
1 error

public class Continents {
	public static void main(String[] args) {

		int continent=4;
    Switch (continent);{
        
      case1:  System.out.println ("North America: Mexico City, Mexico");
        break;
        
        case2: System.out.println ("South America: Sao Paulo, Brazil");
        break;
        
        case3: System.out.println ("Europe: Moscow, Russia");
          break;
        
        case4: System.out.println ("Africa: Lagos, Nigeria");
        break;
        
        case5: System.out.println ("Asia: Shanghai, China");
        break;
        
        case6: System.out.println ("Australia: Sydney, Australia");
        break;
        
        case7: System.out.println ("Antarctica: McMurdo Station, US");
        break;
        
      default: System.out.println ("Undefined continent!");
      break;
        
	    }
 
   }
}

#2

Woops, missed the last few lines of code which is where the error lies!


    
  default: System.out.println ("Undefined continent!");
  break;
    
    }

}
}



#3

Please check the syntax here it should rather be

case 1:

and

case 2:

etc

Also no semicolon here


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.