what is a hasmap java code example
Example: java hashmap syntax
import java.util.HashMap;
HashMap<String, String> capitalCities = new HashMap<String, String>();
capitalCities.put("England", "London");
capitalCities.put("Germany", "Berlin");
capitalCities.put("Norway", "Oslo");
capitalCities.put("USA", "Washington DC");
System.out.println(capitalCities);
Map<String, Integer> stGrade = new HashMap<String, Integer>();
stGrade.put("aaron", new Integer(90));
stGrade.put("isaac", new Integer(100));
stGrade.put("john", new Integer(35));
stGrade.put("mohammad", new Integer(100));
stGrade.get("mohammad");
stGrade.get("aaron");
stGrade.get("john");
stGrade.get("isaac");