9/13 HashMap Problem


#1



https://www.codecademy.com/en/courses/learn-java/lessons/data-structures/exercises/hashmap


I keep getting the error message: Did you create the restaurantMenu HashMap inside of main?


import java.util.HashMap;

public class Restaurant {
	public static void main(String[] args) {
	HashMap <String, Integer> restaurantMenu = new HashMap <String, Integer>();
	}
}


#2

after Hashmap don't leave gap, also type the second Hashmap on next line, it'd work.


#3

I am having the same issue at the moment and I swear my code is on point. Anything you can suggest?

import java.util.HashMap;

public class Restaurant {
	public static void main(String[] args) {

HashMap<String, Integer> restaurantMenu = new
Hashmap<String, Integer>();
	}
}

I went ahead and reset and just did copy and past and it took the new code...


#5

A post was split to a new topic: I'm having the same problem, can't find anything wrong with this


#6

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