This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ 2nd edition - wrong answer marked as correct Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ 2nd edition - wrong answer marked as correct" Watch "HFSJ 2nd edition - wrong answer marked as correct" New topic
Author

HFSJ 2nd edition - wrong answer marked as correct

Aj Deschanel
Ranch Hand

Joined: Oct 20, 2009
Posts: 40
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.


SCJP 1.6, SCWCD 1.5
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFSJ 2nd edition - wrong answer marked as correct
 
Similar Threads
hfs chap-8 qno-7 doubt
Confusing in EL
Anonymous Inner Classes
HFSJ 1st edition, help me understand this
EL expressions