Chapter 8, page 433, Answer for question 7.
Option C should not be marked, since ${foo["5"]} works fine for arrays and Lists, "5" is coerced to an int.
what do you think ?
Option C:
${foo["5"]} is valid syntax if foo is a Map
PS
I think I am wrong, since the enunciation sentence doesn't exclude arrays and Lists from the context, they just assume that foo is a Map.
so option 7c is good.
I guess I took it as "${foo["5"]} is valid syntax ONLY if foo is a Map " which has a slightly different meaning.
Isn't this saying get me the value from the map foo where the key is "5" so it is valid, same as the Java syntax Map.get(Object key) - I may be wrong though!
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
a bit of art, as a gift, the permaculture playing cards