0
/ 2.0
Consider a dictionary that, given an English word, returns the corresponding Spanish word. This dictionary is stored in a ...
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 feedback will appear here when you check your answer.