Project: Language Families (JAVA)

When you ask a question, don’t forget to https://www.codecademy.com/courses/learn-java/projects/java-language-families to the exercise or project you’re dealing with!

Hi I need help with the **project excercise: ** Language Families

 class Language 
 {
   protected String name;
   protected int numSpeakers;
   protected String regionsSpoken;
   protected String wordOrder;
 
   Language(String langName, int speakers, String regions, String wdOrder) 
   {
   }
 
   public void getInfo() 
   {
 
     System.out.println(this.name + " is spoken by " + this.numSpeakers + " people mainly in " + this.regionsSpoken + ".");
 
     System.out.println("The language follows the word order: " + this.wordOrder + ".");
   }
 
   public static void main(String[] args)
   {
     Language spanish = new Language("Spanish", 477000000, "South-America and spain", "Subject + Verb + (rest of sentence)");
     spanish.getInfo();
     Mayan chontal = new Mayan("Chontal", 36810);
     chontal.getInfo();
   }
 
 }
 
 
 
 class Mayan extends Language
 {
   Mayan(String languageName, int speakers)
   { 
     super(languageName, speakers, "Central America" ,"verb-object-subject");
   }
 
   @Override
   public void getInfo() 
   {
     System.out.println(this.name +" is spoken by " + this.numSpeakers + " people mainly in " + this.regionsSpoken + ".");
 System.out.println("The language follows the word order: " + this.wordOrder);
 System.out.println("Fun fact: " + this.name + "is an ergative language.");
   }
 
 }

When I run the code:
null is spoken by 0 people mainly in null.
The language follows the word order: null.
null is spoken by 0 people mainly in null.
The language follows the word order: null
Fun fact: nullis an ergative language.

I have no idea why it doesnt pick up the variables, it gives alot of null’s

Can somebody explain me what went wrong?

Hi there, welcome to the forums!

You’ve declared those class variables, but can you see where you’ve initialised them with any value?

Answer: You haven’t. You should be doing this in the Language() method, but yours is empty.

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