9/13 HashMap Problem

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

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/learn-java/lessons/data-structures/exercises/hashmap

<In what way does your code behave incorrectly? Include ALL error messages.>
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>();
}
}

<do not remove the three backticks above>

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

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…

1 Like

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

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