Error on Language Families Project

Hi, I’m working through the Language Families project: https://www.codecademy.com/courses/learn-java/projects/java-language-families.

At Step 4 I ran the code to make sure it would work, and it gives me the error message, "Could not find or load main class Language. " I can’t for the life of me figure out why. I went over the code multiple times and haven’t found the error. I copied my code and pasted it into Intellij Real to see if that would help, and in that code editor it flags the final line “spanish.getInfo” as if it can’t recognize “getInfo.” I feel like I’m missing something simple, but I can’t figure it out. Code below. Any help would be appreciated!

class Language {

protected String name;
protected int numSpeakers;
protected String regionsSpoken;
protected String wordOrder;

public Language (String langName, int speakers, String regions, String wdOrder){
this.name = langName;
this.numSpeakers = speakers;
this.regionsSpoken = regions;
this.wordOrder = wdOrder;
}

public void getInfo(){
System.out.println(name + " is spoken by " + numSpeakers + "mainly in " + regionsSpoken + ". \n The language follows the word order: " + wordOrder);
}

public static void main (String args){
Language spanish = new Language(“Spanish”, 3355, “Mexico”, “subject+verb+object”);
spanish.getInfo;

}

}

I found a workaround, but not sure if I was supposed to do that lol . I changed public void getInfo(){ to public String getInfo(){ and then replaced the system.out.println command with return. The instructions said the method should NOT return anything, so I’d still like to know how they intended for us to do it, if anyone reads this. Also if my workaround is actually a landmine waiting to blow up, I’d appreciate knowing that too. :slight_smile:

1 Like

I think I had the same problem…your answer might fix it.

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