File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes hfs chap-8 qno-7 doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "hfs chap-8 qno-7 doubt" Watch "hfs chap-8 qno-7 doubt" New topic
Author

hfs chap-8 qno-7 doubt

avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

hello everybody

in the question one option is
${foo["5"] is valid syntax if foo is a Map
which is given correct.

i know that we can write an attribute name which doesn't follow the java rules for naming an identifier with double quotes inside [ ] while using EL i.e. will be valid

but can "5" be a key for a map ??? as it doesn't follow the java rules (can't start with a digit )
or am i missing some point here ??

avi sinha


SCJP 5.0 SCWCD 5.0
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

Well you can always put a "5" as a key in a map, "5" is after all a string, even you can have 5 as a key in a map as the compiler will autobox it into Integer. A key in the map needs to be an object whether String "5" or Integer 5 or anything else...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

oops what was i doing ???

well i think i need a break.actually my exams are going on and a lot of cryptography , industrial management , distributed computing .... they are just playing cricket inside my mind.
unable to think properly
anyways thanks alot ankit

avi sinha
 
 
subject: hfs chap-8 qno-7 doubt