how to get values in hashmap code example
Example: java hashmap get value
package com.tutorialspoint;
import java.util.*;
public class HashMapDemo {
public static void main(String args[]) {
// create hash map
HashMap newmap = new HashMap();
// populate hash map
newmap.put(1, "tutorials");
newmap.put(2, "point");
newmap.put(3, "is best");
// get value of key 3
String val = (String)newmap.get(3);
// check the value
System.out.println("Value for key 3 is: " + val);
}
}