X1137: Get value from hashmap

Consider a dictionary that given an English word, returns the Spanish word. Such a dictionary is stored in a HashMap<String, String>() where the key is in English and the value is in Spanish. Write a method getSpanish() that returns the Spanish word from the dictionary. If the word is not there you must 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.