I need help! Seems like a simple error


#1



https://www.codecademy.com/courses/learn-java/projects/continents-cities


Continents.java:28: error: : expected
default = continent = "Undefined continent!";
^
Continents.java:28: error: illegal start of expression
default = continent = "Undefined continent!";
^
2 errors


public class Continents {
	public static void main(String[] args) {
    int continent = 4;
      
      switch (continent) {
          
      case 1: continent = (1);
          System.out.println("Mexico City, Mexico");
          break;
      case 2: continent = (2);
          System.out.println("South America: Sao Paulo, Brazil");
          break;
      case 3: continent = (3);
          System.out.println("Europe: Moscow, Russia");
          break;
      case 4: continent = (4);
          System.out.println("Africa: Lagos, Nigeria");
          break;
      case 5: continent = (5);
          System.out.println("Asia: Shanghai, China");
          break;
      case 6: continent = (6);
          System.out.println("Australia: Sydney, Australia");
          break;
      case 7: continent = (7);
          System.out.println("Antartica: McMurdo Station, US");
          break;
      default =  continent = "Undefined continent!";
          break;
         
    
  
    
  
      }
System.out.println(continent);
	}
}


#2

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