import java.util.Hashtable; class Main { public static void main(String[] args) { Hashtablegrades = new Hashtable (); grades.put("Math", 90); grades.put("Science", 85); grades.put("History", 92); System.out.println(grades); // {Science=85, History=92, Math=90} } }
import java.util.Hashtable; class Main { public static void main(String[] args) { HashtableIn this example, we updated the value for the key "Science" from 85 to 90. Package library: java.utilgrades = new Hashtable (); grades.put("Math", 90); grades.put("Science", 85); grades.put("History", 92); grades.put("Science", 90); System.out.println(grades); // {Science=90, History=92, Math=90} } }