I have a couple of question that came up during the exercise 12/13
1st of all : In the first example : ‘’’ for (String name: myFriends.keySet()) {
System.out.println(name + " is age: " + myFriends.get(name));'''
and the exercise : for (String item : restaurantMenu.keySet()) {
How is the software able to identify if it’s a name or an item ? it’s really strange that it can know that mark is a name and pizza is an item when we never entered anything about it . Does the software contain all the name in the world ? and all items ?
I hope i don’t sound stupid after this lol but it’s strange
And what is .keySet in the above example ?
I would highly apreciate ifsomeone could explain this to me. Because i’m eager to learn everything .
and btw this is the best website out there
<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-java/lessons/data-structures/exercises/hashmap-iterating?action=resume
<In what way does your code behave incorrectly? Include ALL error messages.>
```import java.util.HashMap;
public class RestaurantForEach {
public static void main(String args) {
HashMap<String, Integer> restaurantMenu = new HashMap<String, Integer>();
restaurantMenu.put("Turkey Burger", 13);
restaurantMenu.put("Naan Pizza", 11);
restaurantMenu.put("Cranberry Kale Salad", 10);
System.out.println(restaurantMenu.size());
for (String item : restaurantMenu.keySet()) {
System.out.println("A " + item + " costs " + restaurantMenu.get(item) + " dollars.");
}
}
}
<do not remove the three backticks above>