X1137: Get value from hashmap

Consider a dictionary that, given an English word, returns the corresponding Spanish word. This dictionary is stored in a HashMap<String, String>, where the key is the English word and the value is the Spanish word. Write a method getSpanish() that returns the Spanish word from the dictionary. If the word is not found, the method should return "?".

HashMap<String, String> dictionary = new HashMap<String, String>();
dictionary.put("blue", "azul");
dictionary.put("green", "verde");
dictionary.put("red", "rojo");

Your Answer:

Feedback

Your feedback will appear here when you check your answer.