Can't figure out what I'm doing wrong here


#1

I am currently stuck on https://www.codecademy.com/courses/learn-java/projects/continents-cities

I get the following error messages
Continents.java:7: error: cannot find symbol
case 1: print("North America: Mexico City, Mexico");
^
symbol: method print(String)
location: class Continents
Continents.java:9: error: cannot find symbol
case 2: println("South America: Sao Paulo, Brazil.");
^
symbol: method println(String)
location: class Continents
Continents.java:11: error: cannot find symbol
case 3: Println("Europe: Moscow, Russia");
^
symbol: method Println(String)
location: class Continents
Continents.java:13: error: cannot find symbol
case 4: println("Africa: Lagos, Nigeria");
^
symbol: method println(String)
location: class Continents
Continents.java:15: error: cannot find symbol
case 5: Println("Asia: Shanghai, China");
^
symbol: method Println(String)
location: class Continents
Continents.java:17: error: cannot find symbol
case 6: Println("Austalia: Sydney, Australia");
^
symbol: method Println(String)
location: class Continents
Continents.java:19: error: cannot find symbol
case 7: Println("Antarctica: McMurdo Station, US");
^
symbol: method Println(String)
location: class Continents
Continents.java:21: error: cannot find symbol
default: Println("Undefined Continent!");
^
symbol: method Println(String)
location: class Continents
8 errors

below is a copy of my code, I am uncertain what I am doing wrong here

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

    //This is our switch statement that selects the appropriate continent, country and capital city
		int continent = 4;
		switch(continent){
          case 1: println("North America: Mexico City, Mexico");
        break;        
      case 2: println("South America: Sao Paulo, Brazil.");
        break;          
      case 3: println("Europe: Moscow, Russia");
        break;        
      case 4: println("Africa: Lagos, Nigeria");
        break;        
      case 5: println("Asia: Shanghai, China");
        break;        
      case 6: println("Austalia: Sydney, Australia");
        break;        
      case 7: println("Antarctica: McMurdo Station, US");
        break;          
      default: println("Undefined Continent!");
        break;
  }
  }
}


#2

Hi @arraymaster51346,

Looking at your code, it's a little bit hard to read... You should at least try to indent properly for us...

However, your problem seems to be the content of your print statements. You are running println without System.out. This can't be called in Java. Make them all System.out.println and it should work.


#3

Thank you, that helped.


#4

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