import java.sql.*;
public class GetCountryData{
 public static void getPop (String code) throws SQLException {
  String sql = "SELECT name,population FROM country WHERE code = ?";
  try {
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setString(1, code);
    ResultSet rset = pstmt.executeQuery();
    if (rset.next()) System.out.println(rset.getString(2));
    conn.close();
  }
  catch (SQLException e) {
    System.err.println(e.getMessage());
  }}}
