title: Java error 'Never used locally'
body: <p>In this java project I having issues displaying the languages that I pulled from a database and stored in a ArrayList to read in my readCountry class. My question why wont it display languages and why does it tell me my readCountryLanguages method in not locally used?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  
  public class Country {
  private int id;
  private String name;
  private long population;
  private double medianAge;
  private List&lt;String&gt; languages;
  
  /**
   * Country Class
   */
  public Country(int id, String name, long population, double medianAge) {
      this.id = id;
      this.name = name;
      this.population = population;
      this.medianAge = medianAge;
      this.languages = new ArrayList&lt;&gt;();
  }
  
  public int getId() {
      return id;
  }
  
  public String getName() {
      return name;
  }
  
  public long getPopulation() {
      return population;
  }
  
  public double getMedianAge() {
      return medianAge;
  }
  
  public void addLanguage (String language) {
      languages.add(language);
  }
  
  public List&lt;String&gt; getLanguages() {
      return languages;
  }
   }
  
  
    public class ReadCountryDB {
    private static final String DB_NAME = "Countries";
    private static final String 
    private static final String COUNTRY_TABLE_NAME = "COUNTRY";
    private static final String USERNAME = "2bjExample";
    private static final String PASSWORD = "tnedutsh332";
  
   private List&lt;Country&gt; countries;
  
  
  
      public ReadCountryDB() {
      Connection connection = null;
      Statement sqlStatement = null;
  
      try {
          connection = DriverManager.getConnection(DB_URL, USERNAME, PASSWORD);
          sqlStatement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
  
          countries = readCountries(sqlStatement);
      } catch (SQLException e) {
          System.err.println("ERROR: " + e.getMessage());
          e.printStackTrace();
      } finally {
          close(sqlStatement);
          close(connection);
      }
  }
  
  
  private List&lt;Country&gt; readCountries(Statement sqlStatement) throws SQLException {
      List&lt;Country&gt; countries = new ArrayList&lt;Country&gt;();
      ResultSet resultSet = sqlStatement.executeQuery("SELECT * FROM " + COUNTRY_TABLE_NAME);
      while (resultSet.next()) {
          countries.add(new Country(resultSet.getInt("Id"),
                                    resultSet.getString("Name"),
                                    resultSet.getLong("Population"),
                                    resultSet.getDouble("MedianAge")));
      }
      return countries;
  
   }
  
  private List&lt;String&gt;readCountryLanguages(Statement sqlStatement) throws SQLException {
      List&lt;String&gt; languages = new ArrayList&lt;&gt;();
      ResultSet resultSet = sqlStatement.executeQuery("SELECT language FROM COUNTRY_LANGUAGE");
      while (resultSet.next()) {
          languages.add(new String(resultSet.getString("CountryID")));
      }
      return languages;
  }
  
  
  /**
   * 
   * @param sqlStatement
   */
  private void close(Statement sqlStatement) {
      if (sqlStatement != null) {
          try {
              sqlStatement.close();
          } catch (SQLException e) {
          }
      }
  }
  
  /**
   * 
   * @param connection
   */
  private void close(Connection connection) {
      if (connection != null) {
          try {
              connection.close();
          } catch (SQLException e) {
          }
      }
  }
  
  /**
   * @return list of countries read from the country database
   */
  public List&lt;Country&gt; getCountries() {
      return countries;
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>import java.util.List;
  
  /**
   * CountryMain class 
  */
  public class CountryMain {
  public static void main(String[] args) {
      ReadCountryDB rcdb = new ReadCountryDB();
      List&lt;Country&gt; countries = rcdb.getCountries();
  
      for (Country firstCountry : countries) {
           System.out.println("First country:");
       System.out.println("Name: " + firstCountry.getName()
                         + "  Population: " + firstCountry.getPopulation()
                         + "  Language: " + firstCountry.getLanguages()
                         + "  Median Age: " + firstCountry.getMedianAge());
      }
                       }
  </code></pre>
  
  <p>}</p>