10/13

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

Here is the question ask us to do:
Let’s add some food items and prices to the our menu. Use the put method to add a key “Turkey Burger” with the value 13.
<Below this line, add a link to the EXACT exercise that you are stuck at.>
I really don’t understand why we should use “put” instead of using “add”?? In the previous lesson, it asked us to type “add” to insert the data such as “quizGrades.add(95);” but how come it asked us to type “put” instead of typing “add” for now??

<In what way does your code behave incorrectly? Include ALL error messages.>

```

Replace this line with your code.

<do not remove the three backticks above>

The ArrayList data structure has an add method.

In this lesson you are working with the HashMap type. This type doesn’t have an add method, but it has a similar method called put.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.