Hello,
Can someone explain why I don't meet the last requirement which consists in displaying the HashMap content?
public class Solution {
HashMap<Integer, String> map;
static Integer indice;
static String nom;
public Solution() {
this.map = new HashMap<Integer, String>();
//map.put(indice, nom);
}
public static void main(String[] args) throws IOException {
Solution solution = new Solution();
BufferedReader lecteur = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 10; i++) {
int indice = Integer.parseInt(lecteur.readLine());
String nom = lecteur.readLine();
solution.map.put(indice, nom);
}
for (Map.Entry<Integer, String> paire : solution.map.entrySet()) {
indice = paire.getKey();
nom = paire.getValue();
System.out.println("Id=" + indice + " Nom=" + nom);
}
}
}
Thanks