Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor

Perfect! Now let's fill the HashMap with useful data.

Add keys and values to a HashMap:

HashMap<String, Integer> myFriends = new HashMap<String, Integer>(); myFriends.put("Mark", 24); myFriends.put("Cassandra", 25); myFriends.put("Zenas", 21);

In the example above, we used the put method to add a String key and an associated Integer value. The String key is the text inside double quotes " ". The Integer value is represented by the number.

report a_bug
If you see a bug or any other issue with this page, please report it here.