Solved

You Want to Enumerate All of the Keys in a Map

Question 94

Multiple Choice

You want to enumerate all of the keys in a map named myMap whose keys are type String.Which of the following statements will allow you to do this?


A) Set<String> keySet = myMap.getKeySet() ; for (String key : keySet) {...}
B) Set<String> keySet = myMap.keySet() ; for (String key : keySet) {...}
C) Set<String> keySet = myMap.keys() ; for (String key : keySet) {...}
D) Set<String> keySet = myMap.getKeys() ; for (String key : keySet) {...}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions