wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFS..pg.420 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..pg.420" Watch "HFS..pg.420" New topic
Author

HFS..pg.420

Deepa Korecherla
Ranch Hand

Joined: Jul 14, 2004
Posts: 197
In the HFS book..the 7th question....Is the "C" option true??
If its true ...will it take the fifth key's value ..??
I don't understand..pls reply..


DKR<br />SCJP1.2,SCWCD1.4,SCBCD1.3,SCJA
melan hen
Greenhorn

Joined: Feb 14, 2005
Posts: 17
Hi, I think it's true, that means foo has an entry which is String type, and the string value is "5",so it is OK.


SCJP 1.2 (88%)<br />SCWCD 1.4 (89%)<br />SCBCD (in progress)<br />SCEA (in progress)
Deepa Korecherla
Ranch Hand

Joined: Jul 14, 2004
Posts: 197
I think its not true....but still can anyone tell...??
It will work if foo is of type List but not Map...can anyone reply??
Deepa Korecherla
Ranch Hand

Joined: Jul 14, 2004
Posts: 197
can anybody reply..with some explanation??
Ranjit Jana
Ranch Hand

Joined: Feb 17, 2005
Posts: 30
I agree ${foo["5"]} and $foo.[5] should be equivalent in List . Assume Map have a key which is of type String "5" then it may make a difference. but surely this is a confusing question . Better Author tell what was in there head.
Bryan Basham
author
Ranch Hand

Joined: Apr 30, 2001
Posts: 199
Hello all,

Option C of question 7 is correct. If 'foo' is a Map, then the argument to the map is some object (here the string "5") that acts as the key into the map.

However, this syntax will also work for lists because EL will convert the string "5" into the integer 5 at runtime to find the index into the list.

Here is a small code example that demonstrates these two use cases.


What do you think the result would be?

Cheers,
Bryan
[ February 22, 2005: Message edited by: Bryan Basham ]
Ranjit Jana
Ranch Hand

Joined: Feb 17, 2005
Posts: 30
Thanks Bryan,

This makes things clear.

I take this opportunity to compliment you for bringing out "HF servlets and JSP". No doubt your sleepless nights for bringing this book out have saved huge volume of midnight oil(at least for me).

:-)

Regards,
Ranajit Jana
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFS..pg.420