To fetch the value associated with a key, call .get() and pass the key:
int aliceAge = ages.get("Alice"); // 31
String result = ages.get("Dave"); // null
When the key exists, you get the stored value back. When it does not exist, .get() returns null. This creates a common bug with primitive types. If you assign the result of .get() to an int and the key is missing, Java tries to unbox null into an int and throws a NullPointerException.
To avoid this, either check with .containsKey() first or use Integer (the wrapper type) as your variable type and handle null yourself.