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.

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??

Replace this line with your code.


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.


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