Exercise 10... hash maps


#1

/* WHATS WRONG WITH THE CODE... DISPLAYS ERROR " USE THE PUT METHOD". BUT I HAVE USED IT. */
import java.util.HashMap;

public class Restaurant {
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("Carnberry Kale Salad",10);

}
}


#2

restaurantMenu.put("Carnberry Kale Salad",10);

string value should be exact same.right now you misspelled.


#3

same content..... closed the browser restarted again... and worked.... Thnx for the help... kuddos....


#4

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