Solved

You Want to Enumerate All of the Keys in a Map

Question 110

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.keySet() ;
For (String key : keySet) {. . . }
B) Set<String> keySet = myMap.getKeys() ;
For (String key : keySet) {. . . }
C) Set<String> keySet = myMap.keys() ;
For (String key : keySet) {. . . }
D) Set<String> keySet = myMap.getKeySet() ;
For (String key : keySet) {. . . }

Correct Answer:

verifed

Verified

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

Related Questions